Class: RBS::Types::Alias
- Inherits:
-
Object
- Object
- RBS::Types::Alias
- Includes:
- EmptyEachType, NoFreeVariables, NoSubst
- Defined in:
- lib/rbs/types.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, location:) ⇒ Alias
constructor
A new instance of Alias.
- #map_type_name ⇒ Object
- #to_json(*a) ⇒ Object
- #to_s(level = 0) ⇒ Object
Methods included from EmptyEachType
Methods included from NoSubst
Methods included from NoFreeVariables
Constructor Details
#initialize(name:, location:) ⇒ Alias
Returns a new instance of Alias.
301 302 303 304 |
# File 'lib/rbs/types.rb', line 301 def initialize(name:, location:) @name = name @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
298 299 300 |
# File 'lib/rbs/types.rb', line 298 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
299 300 301 |
# File 'lib/rbs/types.rb', line 299 def name @name end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
306 307 308 |
# File 'lib/rbs/types.rb', line 306 def ==(other) other.is_a?(Alias) && other.name == name end |
#hash ⇒ Object
312 313 314 |
# File 'lib/rbs/types.rb', line 312 def hash self.class.hash ^ name.hash end |
#map_type_name ⇒ Object
329 330 331 332 333 334 |
# File 'lib/rbs/types.rb', line 329 def map_type_name Alias.new( name: yield(name, location, self), location: location ) end |
#to_json(*a) ⇒ Object
319 320 321 |
# File 'lib/rbs/types.rb', line 319 def to_json(*a) { class: :alias, name: name, location: location }.to_json(*a) end |
#to_s(level = 0) ⇒ Object
323 324 325 |
# File 'lib/rbs/types.rb', line 323 def to_s(level = 0) name.to_s end |