Class: Eggshell::ExpressionEvaluator::ExprArray
- Inherits:
-
Array
- Object
- Array
- Eggshell::ExpressionEvaluator::ExprArray
- Defined in:
- lib/eggshell/expression-evaluator.rb
Instance Attribute Summary collapse
-
#dyn_keys ⇒ Object
readonly
Returns the value of attribute dyn_keys.
-
#dynamic ⇒ Object
Returns the value of attribute dynamic.
Instance Method Summary collapse
-
#<<(term) ⇒ Object
Adds a term to the array.
Instance Attribute Details
#dyn_keys ⇒ Object (readonly)
Returns the value of attribute dyn_keys.
32 33 34 |
# File 'lib/eggshell/expression-evaluator.rb', line 32 def dyn_keys @dyn_keys end |
#dynamic ⇒ Object
Returns the value of attribute dynamic.
31 32 33 |
# File 'lib/eggshell/expression-evaluator.rb', line 31 def dynamic @dynamic end |
Instance Method Details
#<<(term) ⇒ Object
Adds a term to the array. If it’s a dynamic statement, its position is marked and this array is marked as dynamic for evaluation later.
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/eggshell/expression-evaluator.rb', line 36 def <<(term) @dyn_keys = [] if !@dyn_keys # cascade dynamic status if term.is_a?(ExprArray) || term.is_a?(ExprHash) if term.dynamic @dynamic = true @dyn_keys << self.length end elsif term.is_a?(Array) if term[0] == :op end term, dyn = Eggshell::ExpressionEvaluator::struct_compact(term) if dyn @dynamic = true @dyn_keys << self.length end end self.push(term) end |