Class: Halunke::ArrayNode

Inherits:
Struct
  • Object
show all
Defined in:
lib/halunke/nodes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nodesObject

Returns the value of attribute nodes

Returns:

  • (Object)

    the current value of nodes



97
98
99
# File 'lib/halunke/nodes.rb', line 97

def nodes
  @nodes
end

#teObject

Returns the value of attribute te

Returns:

  • (Object)

    the current value of te



97
98
99
# File 'lib/halunke/nodes.rb', line 97

def te
  @te
end

#tsObject

Returns the value of attribute ts

Returns:

  • (Object)

    the current value of ts



97
98
99
# File 'lib/halunke/nodes.rb', line 97

def ts
  @ts
end

Instance Method Details

#==(other) ⇒ Object



102
103
104
105
# File 'lib/halunke/nodes.rb', line 102

def ==(other)
  other.is_a?(ArrayNode) &&
    nodes == other.nodes
end

#eval(context) ⇒ Object



98
99
100
# File 'lib/halunke/nodes.rb', line 98

def eval(context)
  context["Array"].create_instance(nodes.map { |node| node.eval(context) })
end

#source_code_positionObject



107
108
109
# File 'lib/halunke/nodes.rb', line 107

def source_code_position
  SourceCodePosition.new(ts, te)
end