Class: Kapusta::GeneratedSym

Inherits:
Sym
  • Object
show all
Defined in:
lib/kapusta/ast.rb

Instance Attribute Summary collapse

Attributes inherited from Sym

#name

Instance Method Summary collapse

Methods inherited from Sym

#dotted?, #segments, #to_s

Constructor Details

#initialize(name, id) ⇒ GeneratedSym

Returns a new instance of GeneratedSym.



52
53
54
55
# File 'lib/kapusta/ast.rb', line 52

def initialize(name, id)
  super(name)
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



50
51
52
# File 'lib/kapusta/ast.rb', line 50

def id
  @id
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



61
62
63
# File 'lib/kapusta/ast.rb', line 61

def ==(other)
  other.is_a?(GeneratedSym) && other.id == @id
end

#binding_keyObject



70
71
72
# File 'lib/kapusta/ast.rb', line 70

def binding_key
  [self.class, @id]
end

#hashObject



66
67
68
# File 'lib/kapusta/ast.rb', line 66

def hash
  [self.class, @id].hash
end

#inspectObject



57
58
59
# File 'lib/kapusta/ast.rb', line 57

def inspect
  "#<GeneratedSym #{@name} #{@id}>"
end