Class: Eggshell::ExpressionEvaluator::ExprArray

Inherits:
Array
  • Object
show all
Defined in:
lib/eggshell/expression-evaluator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#dyn_keysObject (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

#dynamicObject

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