4 ms·
puts puts_method.class #=> Method puts my_block.class #=> Proc Method and Proc are types; blocks are a syntactic construct.
by tesseract 17y ago
puts puts_method.class #=> Method
puts my_block.class #=> Proc
Method and Proc are types; blocks are a syntactic construct.
- sjs 17y agoYou're right, captured blocks are instances of Proc. However I still claim that methods are objects that can be passed around, assigned to variables, and sent messages. Method and UnboundMethod are both classes that inherit from Object. It's right there in proc.c with the Proc class. Method.ancestors #=> [Method, Object, Kernel]
- tesseract 17y agoI don't disagree with you there.
- jfarmer 17y agoDidn't know that. Ruby, you crazy.