Class: Halunke::BarewordNode

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



44
45
46
# File 'lib/halunke/nodes.rb', line 44

def te
  @te
end

#tsObject

Returns the value of attribute ts

Returns:

  • (Object)

    the current value of ts



44
45
46
# File 'lib/halunke/nodes.rb', line 44

def ts
  @ts
end

#valueObject

Returns the value of attribute value

Returns:

  • (Object)

    the current value of value



44
45
46
# File 'lib/halunke/nodes.rb', line 44

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



51
52
53
54
# File 'lib/halunke/nodes.rb', line 51

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

#eval(context) ⇒ Object



45
46
47
48
49
# File 'lib/halunke/nodes.rb', line 45

def eval(context)
  context[value]
rescue KeyError
  raise HUnassignedBareword.new("Bareword '#{value} is unassigned", source_code_position)
end

#source_code_positionObject



56
57
58
# File 'lib/halunke/nodes.rb', line 56

def source_code_position
  SourceCodePosition.new(ts, te)
end