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