<< Object | Index | RemainderOperator >>
## Proc ##
a = Proc.new {|x| x*2}
## normal method ##
def aaa(x)
x*2
end
p a.call(3)
p aaa(3)
Another Proc sample
## Proc Style ##
a = Proc.new {|odba_item| [odba_item]}
b = a.call('123')
p b
## Method Style ##
def aaa(odba_item)
[odba_item]
end
b = aaa('123')
p b
also see
http://www.ruby-doc.org/core/classes/Proc.html#M000547
Illustration from the Well Grounded Rubyist:
