Class: Grape::Util::Lazy::Value
- Defined in:
- lib/grape/util/lazy/value.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#access_keys ⇒ Object
readonly
Returns the value of attribute access_keys.
Instance Method Summary collapse
- #evaluate ⇒ Object
- #evaluate_from(configuration) ⇒ Object
-
#initialize(value, access_keys = []) ⇒ Value
constructor
A new instance of Value.
- #reached_by(parent_access_keys, access_key) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(value, access_keys = []) ⇒ Value
Returns a new instance of Value.
9 10 11 12 13 |
# File 'lib/grape/util/lazy/value.rb', line 9 def initialize(value, access_keys = []) super() @value = value @access_keys = access_keys end |
Instance Attribute Details
#access_keys ⇒ Object (readonly)
Returns the value of attribute access_keys.
7 8 9 |
# File 'lib/grape/util/lazy/value.rb', line 7 def access_keys @access_keys end |
Instance Method Details
#evaluate ⇒ Object
20 21 22 |
# File 'lib/grape/util/lazy/value.rb', line 20 def evaluate @value end |
#evaluate_from(configuration) ⇒ Object
15 16 17 18 |
# File 'lib/grape/util/lazy/value.rb', line 15 def evaluate_from(configuration) matching_lazy_value = configuration.fetch(@access_keys) matching_lazy_value.evaluate end |
#reached_by(parent_access_keys, access_key) ⇒ Object
24 25 26 27 |
# File 'lib/grape/util/lazy/value.rb', line 24 def reached_by(parent_access_keys, access_key) @access_keys = parent_access_keys + [access_key] self end |