Class: RBS::Definition::Ancestor::Singleton

Inherits:
Object
  • Object
show all
Defined in:
lib/rbs/definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:) ⇒ Singleton

Returns a new instance of Singleton.



201
202
203
# File 'lib/rbs/definition.rb', line 201

def initialize(name:)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



199
200
201
# File 'lib/rbs/definition.rb', line 199

def name
  @name
end

Instance Method Details

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



205
206
207
# File 'lib/rbs/definition.rb', line 205

def ==(other)
  other.is_a?(Singleton) && other.name == name
end

#hashObject



211
212
213
# File 'lib/rbs/definition.rb', line 211

def hash
  self.class.hash ^ name.hash
end