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

#colon_segments, #colonized?, #dotted?, #segments, #to_s

Constructor Details

#initialize(name, id) ⇒ GeneratedSym

Returns a new instance of GeneratedSym.



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

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

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

Instance Method Details

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



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

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

#binding_keyObject



81
82
83
# File 'lib/kapusta/ast.rb', line 81

def binding_key
  [self.class, @id]
end

#hashObject



77
78
79
# File 'lib/kapusta/ast.rb', line 77

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

#inspectObject



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

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