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(state = _ = nil) ⇒ Object
Constructor Details
#initialize(name:, type:, annotations:, location:, comment:) ⇒ Alias
Returns a new instance of Alias.
370 371 372 373 374 375 376 |
# File 'lib/rbs/ast/declarations.rb', line 370 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.
366 367 368 |
# File 'lib/rbs/ast/declarations.rb', line 366 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
368 369 370 |
# File 'lib/rbs/ast/declarations.rb', line 368 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
367 368 369 |
# File 'lib/rbs/ast/declarations.rb', line 367 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
364 365 366 |
# File 'lib/rbs/ast/declarations.rb', line 364 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
365 366 367 |
# File 'lib/rbs/ast/declarations.rb', line 365 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
378 379 380 381 382 |
# File 'lib/rbs/ast/declarations.rb', line 378 def ==(other) other.is_a?(Alias) && other.name == name && other.type == type end |
#hash ⇒ Object
386 387 388 |
# File 'lib/rbs/ast/declarations.rb', line 386 def hash self.class.hash ^ name.hash ^ type.hash end |
#to_json(state = _ = nil) ⇒ Object
390 391 392 393 394 395 396 397 398 399 |
# File 'lib/rbs/ast/declarations.rb', line 390 def to_json(state = _ = nil) { declaration: :alias, name: name, type: type, annotations: annotations, location: location, comment: comment }.to_json(state) end |