Class: EacRubyUtils::ByReference
- Inherits:
-
Object
- Object
- EacRubyUtils::ByReference
show all
- Defined in:
- lib/eac_ruby_utils/by_reference.rb
Instance Method Summary
collapse
Constructor Details
#initialize(&object_provider) ⇒ ByReference
Returns a new instance of ByReference.
3
4
5
|
# File 'lib/eac_ruby_utils/by_reference.rb', line 3
def initialize(&object_provider)
@object_provider = object_provider
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
7
8
9
10
|
# File 'lib/eac_ruby_utils/by_reference.rb', line 7
def method_missing(method_name, *arguments, &block)
return object.send(method_name, *arguments) if object.respond_to?(method_name)
super
end
|
Instance Method Details
12
13
14
|
# File 'lib/eac_ruby_utils/by_reference.rb', line 12
def object
@object_provider.call
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
16
17
18
|
# File 'lib/eac_ruby_utils/by_reference.rb', line 16
def respond_to_missing?(method_name, include_private = false)
object.respond_to?(method_name, include_private)
end
|