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(state = _ = nil) ⇒ Object
Constructor Details
#initialize(name:, type:, location:, comment:) ⇒ Global
Returns a new instance of Global.
444 445 446 447 448 449 |
# File 'lib/rbs/ast/declarations.rb', line 444 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.
442 443 444 |
# File 'lib/rbs/ast/declarations.rb', line 442 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
441 442 443 |
# File 'lib/rbs/ast/declarations.rb', line 441 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
439 440 441 |
# File 'lib/rbs/ast/declarations.rb', line 439 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
440 441 442 |
# File 'lib/rbs/ast/declarations.rb', line 440 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
451 452 453 454 455 |
# File 'lib/rbs/ast/declarations.rb', line 451 def ==(other) other.is_a?(Global) && other.name == name && other.type == type end |
#hash ⇒ Object
459 460 461 |
# File 'lib/rbs/ast/declarations.rb', line 459 def hash self.class.hash ^ name.hash ^ type.hash end |
#to_json(state = _ = nil) ⇒ Object
463 464 465 466 467 468 469 470 471 |
# File 'lib/rbs/ast/declarations.rb', line 463 def to_json(state = _ = nil) { declaration: :global, name: name, type: type, location: location, comment: comment }.to_json(state) end |