Class: Delegator
- Inherits:
- BasicObject
- Defined in:
- opal/stdlib/delegate.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(obj) ⇒ Delegator
constructor
A new instance of Delegator.
- #method_missing(m, *args, &block) ⇒ Object
Constructor Details
#initialize(obj) ⇒ Delegator
Returns a new instance of Delegator
2 3 4 |
# File 'opal/stdlib/delegate.rb', line 2 def initialize(obj) __setobj__(obj) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(m, *args, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'opal/stdlib/delegate.rb', line 6 def method_missing(m, *args, &block) target = self.__getobj__ if target.respond_to?(m) target.__send__(m, *args, &block) else super(m, *args, &block) end end |