Class: Kapusta::GeneratedSym

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

Instance Attribute Summary collapse

Attributes inherited from Sym

#column, #line, #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.



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

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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

Instance Method Details

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



64
65
66
# File 'lib/kapusta/ast.rb', line 64

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

#binding_keyObject



73
74
75
# File 'lib/kapusta/ast.rb', line 73

def binding_key
  [self.class, @id]
end

#hashObject



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

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

#inspectObject



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

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