In the book Programming Ruby: The Pragmatic Programmers Guide by Dave Thomas with Chad Fowler and Andy Hunt, regarding the creation of Proc
s there is a footnote that states:
"There’s actually a third, proc, but it is effectively deprecated."
I could not find which way is this. I am aware of the following ways to create a Proc
:
1
b = lambda { | msg | puts "msg: #{msg}" }
b.call("hi")
2
def create_block_object(&block)
block
end
b = create_block_object{ |msg| puts "msg: #{msg}" }
b.call("hello")
3
b = Proc.new { |msg| puts "msg: #{msg}"}
b.call("hey")
I want to know the fourth way and would be glad if somebody would give me an answer.