Class: Indocker::DSLContext
- Inherits:
-
Object
- Object
- Indocker::DSLContext
- Defined in:
- lib/indocker/dsl_context.rb
Instance Attribute Summary collapse
-
#storage ⇒ Object
readonly
Returns the value of attribute storage.
Instance Method Summary collapse
-
#initialize(storage = {}) ⇒ DSLContext
constructor
A new instance of DSLContext.
- #method_missing(method, *args) ⇒ Object
- #set_value(key, value) ⇒ Object
Constructor Details
#initialize(storage = {}) ⇒ DSLContext
Returns a new instance of DSLContext.
4 5 6 |
# File 'lib/indocker/dsl_context.rb', line 4 def initialize(storage = {}) @storage = storage end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
8 9 10 11 12 |
# File 'lib/indocker/dsl_context.rb', line 8 def method_missing(method, *args) super unless @storage.key?(method) @storage.fetch(method) end |
Instance Attribute Details
#storage ⇒ Object (readonly)
Returns the value of attribute storage.
2 3 4 |
# File 'lib/indocker/dsl_context.rb', line 2 def storage @storage end |
Instance Method Details
#set_value(key, value) ⇒ Object
14 15 16 |
# File 'lib/indocker/dsl_context.rb', line 14 def set_value(key, value) @storage[key] = value end |