Class: Steep::TypeName::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/steep/type_name.rb

Direct Known Subclasses

Class, Instance, Interface, Module

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:) ⇒ Base



6
7
8
# File 'lib/steep/type_name.rb', line 6

def initialize(name:)
  @name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/steep/type_name.rb', line 4

def name
  @name
end

Instance Method Details

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



10
11
12
# File 'lib/steep/type_name.rb', line 10

def ==(other)
  other.is_a?(self.class) && other.name == name
end

#hashObject



14
15
16
# File 'lib/steep/type_name.rb', line 14

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

#map_module_nameObject



24
25
26
# File 'lib/steep/type_name.rb', line 24

def map_module_name
  self.class.new(name: yield(name))
end

#to_sObject



20
21
22
# File 'lib/steep/type_name.rb', line 20

def to_s
  name.to_s
end