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.
- #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.
266 267 268 269 |
# File 'lib/rbs/types.rb', line 266 def initialize(name:, location:) @name = name @location = location end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
263 264 265 |
# File 'lib/rbs/types.rb', line 263 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
264 265 266 |
# File 'lib/rbs/types.rb', line 264 def name @name end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
271 272 273 |
# File 'lib/rbs/types.rb', line 271 def ==(other) other.is_a?(Alias) && other.name == name end |
#hash ⇒ Object
277 278 279 |
# File 'lib/rbs/types.rb', line 277 def hash self.class.hash ^ name.hash end |
#to_json(*a) ⇒ Object
284 285 286 |
# File 'lib/rbs/types.rb', line 284 def to_json(*a) { class: :alias, name: name, location: location }.to_json(*a) end |
#to_s(level = 0) ⇒ Object
288 289 290 |
# File 'lib/rbs/types.rb', line 288 def to_s(level = 0) name.to_s end |