Class: EXEL::DeferredContextValue
- Inherits:
-
Object
- Object
- EXEL::DeferredContextValue
- Defined in:
- lib/exel/deferred_context_value.rb
Instance Attribute Summary collapse
-
#keys ⇒ Object
readonly
Returns the value of attribute keys.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #get(context) ⇒ Object
-
#initialize ⇒ DeferredContextValue
constructor
A new instance of DeferredContextValue.
Constructor Details
#initialize ⇒ DeferredContextValue
Returns a new instance of DeferredContextValue.
5 6 7 |
# File 'lib/exel/deferred_context_value.rb', line 5 def initialize @keys = [] end |
Instance Attribute Details
#keys ⇒ Object (readonly)
Returns the value of attribute keys.
3 4 5 |
# File 'lib/exel/deferred_context_value.rb', line 3 def keys @keys end |
Instance Method Details
#[](key) ⇒ Object
9 10 11 12 |
# File 'lib/exel/deferred_context_value.rb', line 9 def [](key) keys << key self end |
#get(context) ⇒ Object
14 15 16 |
# File 'lib/exel/deferred_context_value.rb', line 14 def get(context) keys.reduce(context) { |a, e| a[e] } end |