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.
429 430 431 432 433 434 |
# File 'lib/rbs/ast/declarations.rb', line 429 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.
427 428 429 |
# File 'lib/rbs/ast/declarations.rb', line 427 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
426 427 428 |
# File 'lib/rbs/ast/declarations.rb', line 426 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
424 425 426 |
# File 'lib/rbs/ast/declarations.rb', line 424 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
425 426 427 |
# File 'lib/rbs/ast/declarations.rb', line 425 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
436 437 438 439 440 |
# File 'lib/rbs/ast/declarations.rb', line 436 def ==(other) other.is_a?(Global) && other.name == name && other.type == type end |
#hash ⇒ Object
444 445 446 |
# File 'lib/rbs/ast/declarations.rb', line 444 def hash self.class.hash ^ name.hash ^ type.hash end |
#to_json(*a) ⇒ Object
448 449 450 451 452 453 454 455 456 |
# File 'lib/rbs/ast/declarations.rb', line 448 def to_json(*a) { declaration: :global, name: name, type: type, location: location, comment: comment }.to_json(*a) end |