Class: Indocker::DSLContext

Inherits:
Object
  • Object
show all
Defined in:
lib/indocker/dsl_context.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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