Class: RBS::AST::Declarations::Global
- Defined in:
- lib/rbs/ast/declarations.rb
Instance Attribute Summary collapse
-
#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:, location:, comment:) ⇒ Global
constructor
A new instance of Global.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(name:, type:, location:, comment:) ⇒ Global
Returns a new instance of Global.
471 472 473 474 475 476 |
# File 'lib/rbs/ast/declarations.rb', line 471 def initialize(name:, type:, location:, comment:) @name = name @type = type @location = location @comment = comment end |
Instance Attribute Details
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
469 470 471 |
# File 'lib/rbs/ast/declarations.rb', line 469 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
468 469 470 |
# File 'lib/rbs/ast/declarations.rb', line 468 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
466 467 468 |
# File 'lib/rbs/ast/declarations.rb', line 466 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
467 468 469 |
# File 'lib/rbs/ast/declarations.rb', line 467 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
478 479 480 481 482 |
# File 'lib/rbs/ast/declarations.rb', line 478 def ==(other) other.is_a?(Global) && other.name == name && other.type == type end |
#hash ⇒ Object
486 487 488 |
# File 'lib/rbs/ast/declarations.rb', line 486 def hash self.class.hash ^ name.hash ^ type.hash end |
#to_json(*a) ⇒ Object
490 491 492 493 494 495 496 497 498 |
# File 'lib/rbs/ast/declarations.rb', line 490 def to_json(*a) { declaration: :global, name: name, type: type, location: location, comment: comment }.to_json(*a) end |