Class: Halunke::StringNode

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#teObject

Returns the value of attribute te

Returns:

  • (Object)

    the current value of te



28
29
30
# File 'lib/halunke/nodes.rb', line 28

def te
  @te
end

#tsObject

Returns the value of attribute ts

Returns:

  • (Object)

    the current value of ts



28
29
30
# File 'lib/halunke/nodes.rb', line 28

def ts
  @ts
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



28
29
30
# File 'lib/halunke/nodes.rb', line 28

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



34
35
36
37
# File 'lib/halunke/nodes.rb', line 34

def ==(other)
  other.is_a?(StringNode) &&
    value == other.value
end

#eval(context) ⇒ Object



29
30
31
32
# File 'lib/halunke/nodes.rb', line 29

def eval(context)
  context["String"].create_instance(value,
                                    source_code_position: source_code_position)
end

#source_code_positionObject



39
40
41
# File 'lib/halunke/nodes.rb', line 39

def source_code_position
  SourceCodePosition.new(ts, te)
end