Class: LazyInstantiation
- Inherits:
-
Object
- Object
- LazyInstantiation
- Defined in:
- lib/adlint/prelude.rb
Instance Method Summary collapse
-
#initialize(klass, *args, &block) ⇒ LazyInstantiation
constructor
A new instance of LazyInstantiation.
- #method_missing(name, *args) ⇒ Object
Constructor Details
#initialize(klass, *args, &block) ⇒ LazyInstantiation
Returns a new instance of LazyInstantiation.
79 80 81 82 83 |
# File 'lib/adlint/prelude.rb', line 79 def initialize(klass, *args, &block) @klass = klass @args = args @block = block end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
87 88 89 90 |
# File 'lib/adlint/prelude.rb', line 87 def method_missing(name, *args) @receiver ||= @klass.new(*@args, &@block) @receiver.__send__(name, *args) end |