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.
5
6
7
|
# File 'lib/eac_ruby_utils/by_reference.rb', line 5
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
9
10
11
12
13
|
# File 'lib/eac_ruby_utils/by_reference.rb', line 9
def method_missing(method_name, *arguments, &block)
return object.send(method_name, *arguments, &block) if object.respond_to?(method_name)
super
end
|
Instance Method Details
15
16
17
|
# File 'lib/eac_ruby_utils/by_reference.rb', line 15
def object
@object_provider.call
end
|
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
19
20
21
|
# File 'lib/eac_ruby_utils/by_reference.rb', line 19
def respond_to_missing?(method_name, include_private = false)
object.respond_to?(method_name, include_private)
end
|