Class: Flagship::Context
- Inherits:
-
Object
show all
- Defined in:
- lib/flagship/context.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Context.
2
3
4
|
# File 'lib/flagship/context.rb', line 2
def initialize
@values = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, args = [], &block) ⇒ Object
10
11
12
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/flagship/context.rb', line 10
def method_missing(name, args = [], &block)
if @values.key?(name)
value = @values[name]
if value.respond_to?(:call)
value.call
else
value
end
else
super
end
end
|
Instance Method Details
#__set(key, value) ⇒ Object
6
7
8
|
# File 'lib/flagship/context.rb', line 6
def __set(key, value)
@values[key.to_sym] = value
end
|
#respond_to_missing?(name, include_private = false) ⇒ Boolean
24
25
26
|
# File 'lib/flagship/context.rb', line 24
def respond_to_missing?(name, include_private = false)
@values.key?(name) or super
end
|