[MacRuby] #1008: Can't get the last line from $_. Need to implement rb_lastline_get and rb_lastline_set.

MacRuby ruby-noreply at macosforge.org
Wed Nov 24 13:11:21 PST 2010


#1008: Can't get the last line from $_. Need to implement rb_lastline_get and
rb_lastline_set.
----------------------------------+-----------------------------------------
 Reporter:  watson1978@…          |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  major                 |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 Test Script:
 {{{
 #!ruby
 require 'tempfile'

 t = Tempfile.new("foo")
 t.puts "1"
 t.puts "2"
 t.puts "3"
 t.close

 def test(io)
   io.gets
   p $_
 end

 io = File.open(t.path)
 io.gets
 p $_

 io.gets
 test(io)

 p $_
 }}}

 Result:
 {{{
 $ ruby19 -v t.rb
 ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-darwin10.4.0]
 "1\n"
 "3\n"
 "2\n"

 $ macruby -v t.rb
 MacRuby 0.8 (ruby 1.9.2) [universal-darwin10.0, x86_64]
 nil
 nil
 nil
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1008>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list