Class: ScopedStruct::ProxyObject
- Inherits:
-
Object
- Object
- ScopedStruct::ProxyObject
- Defined in:
- lib/scoped_struct.rb
Instance Method Summary collapse
-
#initialize(parent, scope_name) ⇒ ProxyObject
constructor
A new instance of ProxyObject.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(parent, scope_name) ⇒ ProxyObject
Returns a new instance of ProxyObject.
14 15 16 |
# File 'lib/scoped_struct.rb', line 14 def initialize(parent, scope_name) @parent, @scope_name = parent, scope_name end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
18 19 20 |
# File 'lib/scoped_struct.rb', line 18 def method_missing(name, *args, &block) @parent.send(@scope_name.to_s + "_" + name.to_s, *args, &block) end |