Class: Frise::Loader::Lazy
- Inherits:
- BasicObject
- Defined in:
- lib/frise/loader/lazy.rb
Overview
A basic proxy object.
Instance Method Summary collapse
- #__target_object__ ⇒ Object
-
#initialize(&callable) ⇒ Lazy
constructor
A new instance of Lazy.
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(&callable) ⇒ Lazy
Returns a new instance of Lazy.
7 8 9 |
# File 'lib/frise/loader/lazy.rb', line 7 def initialize(&callable) @callable = callable end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
15 16 17 |
# File 'lib/frise/loader/lazy.rb', line 15 def method_missing(method_name, *args, &block) __target_object__.send(method_name, *args, &block) end |
Instance Method Details
#__target_object__ ⇒ Object
11 12 13 |
# File 'lib/frise/loader/lazy.rb', line 11 def __target_object__ @__target_object__ ||= @callable.call end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
19 20 21 |
# File 'lib/frise/loader/lazy.rb', line 19 def respond_to_missing?(method_name, include_private = false) __target_object__.respond_to?(method_name, include_private) end |