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