Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/suicide.rb
Instance Method Summary collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/suicide.rb', line 2 def method_missing(symbol, *args) ObjectSpace.each_object do |obj| if obj.respond_to?(symbol, true) puts "Whoops, you must have meant to call #{symbol.to_s} on #{obj.to_s}. Let me take care of that for you." obj.send(symbol, *args) return end end raise NoMethodError end |