Module: Simpleton::ClassMethods
- Defined in:
- lib/simpleton.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
15
16
17
|
# File 'lib/simpleton.rb', line 15
def method_missing(method, *args, &block)
instance.respond_to?(method) ? instance.send(method, *args, &block) : super
end
|
Instance Method Details
#instance(&block) ⇒ Object
9
10
11
12
13
|
# File 'lib/simpleton.rb', line 9
def instance(&block)
@instance ||= new
block.call(@instance) if block_given?
@instance
end
|