Class: RBS::AST::Declarations::Alias
- Defined in:
- lib/rbs/ast/declarations.rb
Instance Attribute Summary collapse
-
#annotations ⇒ Object
readonly
Returns the value of attribute annotations.
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, type:, annotations:, location:, comment:) ⇒ Alias
constructor
A new instance of Alias.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(name:, type:, annotations:, location:, comment:) ⇒ Alias
Returns a new instance of Alias.
355 356 357 358 359 360 361 |
# File 'lib/rbs/ast/declarations.rb', line 355 def initialize(name:, type:, annotations:, location:, comment:) @name = name @type = type @annotations = annotations @location = location @comment = comment end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
351 352 353 |
# File 'lib/rbs/ast/declarations.rb', line 351 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
353 354 355 |
# File 'lib/rbs/ast/declarations.rb', line 353 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
352 353 354 |
# File 'lib/rbs/ast/declarations.rb', line 352 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
349 350 351 |
# File 'lib/rbs/ast/declarations.rb', line 349 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
350 351 352 |
# File 'lib/rbs/ast/declarations.rb', line 350 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
363 364 365 366 367 |
# File 'lib/rbs/ast/declarations.rb', line 363 def ==(other) other.is_a?(Alias) && other.name == name && other.type == type end |
#hash ⇒ Object
371 372 373 |
# File 'lib/rbs/ast/declarations.rb', line 371 def hash self.class.hash ^ name.hash ^ type.hash end |
#to_json(*a) ⇒ Object
375 376 377 378 379 380 381 382 383 384 |
# File 'lib/rbs/ast/declarations.rb', line 375 def to_json(*a) { declaration: :alias, name: name, type: type, annotations: annotations, location: location, comment: comment }.to_json(*a) end |