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.



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

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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

Instance Method Details

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



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

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

#binding_keyObject



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

def binding_key
  [self.class, @id]
end

#hashObject



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

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

#inspectObject



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

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