18. Open class
NOT Objects
• comments (# comment, =begin =end)
• punctuation marks (, ; ( .)
• statements (if while for defined? yield super)
• operators (&. || && =)
• blocks (do..end, {..})
• methods (not method objects)
Methods are a fundamental part of Ruby's syntax, but they are not values that Ruby
programs can operate on. That is, Ruby's methods are not objects in the way that strings,
numbers, and arrays are. It is possible, however, to obtain a Method object that represents a
given method, and we can invoke methods indirectly through Method objects.
(c) The Ruby Programming Language. D. Flanagan; Y. Matsumoto
operators table
47. Summary
• Avoid metaprogramming if it is possible!
• Be smart in monkeypatching
• Statements are not methods
• Prefer lambdas over procs
• Use super in method_missing
• Keep scope in mind
• Comment out!
48. 1. Metaprogramming Ruby 2.0
(book)
2. The Ruby Programming Language
(book, Reflection and Metaprogramming section)
3. Ruby Under a Microscope
(Objects and Classes, Constants Lookup)
4. Codebases lessons
Investigate Further