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.



228
229
230
# File 'lib/rbs/definition.rb', line 228

def initialize(name:)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



226
227
228
# File 'lib/rbs/definition.rb', line 226

def name
  @name
end

Instance Method Details

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



232
233
234
# File 'lib/rbs/definition.rb', line 232

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

#hashObject



238
239
240
# File 'lib/rbs/definition.rb', line 238

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