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.
391 392 393 394 395 396 397 |
# File 'lib/rbs/ast/declarations.rb', line 391 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.
387 388 389 |
# File 'lib/rbs/ast/declarations.rb', line 387 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
389 390 391 |
# File 'lib/rbs/ast/declarations.rb', line 389 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
388 389 390 |
# File 'lib/rbs/ast/declarations.rb', line 388 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
385 386 387 |
# File 'lib/rbs/ast/declarations.rb', line 385 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
386 387 388 |
# File 'lib/rbs/ast/declarations.rb', line 386 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
399 400 401 402 403 |
# File 'lib/rbs/ast/declarations.rb', line 399 def ==(other) other.is_a?(Alias) && other.name == name && other.type == type end |
#hash ⇒ Object
407 408 409 |
# File 'lib/rbs/ast/declarations.rb', line 407 def hash self.class.hash ^ name.hash ^ type.hash end |
#to_json(*a) ⇒ Object
411 412 413 414 415 416 417 418 419 420 |
# File 'lib/rbs/ast/declarations.rb', line 411 def to_json(*a) { declaration: :alias, name: name, type: type, annotations: annotations, location: location, comment: comment }.to_json(*a) end |