Class: Halunke::NumberNode

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



12
13
14
# File 'lib/halunke/nodes.rb', line 12

def te
  @te
end

#tsObject

Returns the value of attribute ts

Returns:

  • (Object)

    the current value of ts



12
13
14
# File 'lib/halunke/nodes.rb', line 12

def ts
  @ts
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



12
13
14
# File 'lib/halunke/nodes.rb', line 12

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
21
# File 'lib/halunke/nodes.rb', line 18

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

#eval(context) ⇒ Object



13
14
15
16
# File 'lib/halunke/nodes.rb', line 13

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

#source_code_positionObject



23
24
25
# File 'lib/halunke/nodes.rb', line 23

def source_code_position
  SourceCodePosition.new(ts, te)
end