Class: EsiAttributeLanguage::HashLookupNode
- Defined in:
- lib/esi_attribute_language.rb
Instance Method Summary collapse
- #execute(context) ⇒ Object
-
#initialize(variable, key) ⇒ HashLookupNode
constructor
A new instance of HashLookupNode.
Methods inherited from Node
cleanse_string, #result, #result_single
Constructor Details
#initialize(variable, key) ⇒ HashLookupNode
Returns a new instance of HashLookupNode.
44 45 46 47 48 |
# File 'lib/esi_attribute_language.rb', line 44 def initialize(variable, key) @variable = variable @key = key end |
Instance Method Details
#execute(context) ⇒ Object
50 51 52 53 54 55 56 57 |
# File 'lib/esi_attribute_language.rb', line 50 def execute(context) case var = result(@variable, context) when Hash var[result(@key, context)] when Set var.include?(result(@key, context)) end end |