This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set up instances | |
# Since blocks cannot be stored in a variable, we create a method to inspect it. | |
def dummy_method(&a_block) | |
puts "A block is a #{a_block.class}" | |
puts "A block instance: #{a_block.inspect}" | |
end | |
a_proc = Proc.new { 'This is a proc' } | |
a_lambda = lambda { 'This is a lamnda' } | |
# test begins | |
dummy_method { 'This is a block' } | |
puts "A proc is a #{a_proc.class}" | |
puts "A proc instance: #{a_proc.inspect}" | |
puts "A lambda is a #{a_lambda.class}" | |
puts "A lambda instance: #{a_lambda.inspect}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment