[MacRuby] #1254: method to proc error

MacRuby ruby-noreply at macosforge.org
Mon May 2 14:25:15 PDT 2011


#1254: method to proc error
----------------------------------+-----------------------------------------
 Reporter:  al_skipp@…            |       Owner:  lsansonetti@…        
     Type:  defect                |      Status:  new                  
 Priority:  blocker               |   Milestone:                       
Component:  MacRuby               |    Keywords:                       
----------------------------------+-----------------------------------------
 There is a problem with the CSV library that prevents custom converters
 from working. The following snippet illustrates the problem (the code
 works fine with ruby 1.9):

 {{{
 require 'csv'
 csv = "one, two  , three"
 CSV.parse(csv, :converters => lambda {|s| s.strip rescue s}) do |row|
   p row
 end
 }}}

 The root of the problem is an error in the way macruby converts methods to
 procs. Here is a reduction.

 {{{
 def call_block(&block)
   block.call
 end
 proc = lambda { puts 'hello'}
 method_as_proc = method(:call_block) # convert method to proc
 call_block(&proc) # works as expected
 method_as_proc.call(&proc) # block becomes nil
 }}}

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



More information about the macruby-tickets mailing list