Class: RBS::AST::Declarations::Global
- Inherits:
-
Object
- Object
- 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.
364 365 366 367 368 369 |
# File 'lib/rbs/ast/declarations.rb', line 364 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.
362 363 364 |
# File 'lib/rbs/ast/declarations.rb', line 362 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
361 362 363 |
# File 'lib/rbs/ast/declarations.rb', line 361 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
359 360 361 |
# File 'lib/rbs/ast/declarations.rb', line 359 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
360 361 362 |
# File 'lib/rbs/ast/declarations.rb', line 360 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
371 372 373 374 375 |
# File 'lib/rbs/ast/declarations.rb', line 371 def ==(other) other.is_a?(Global) && other.name == name && other.type == type end |
#hash ⇒ Object
379 380 381 |
# File 'lib/rbs/ast/declarations.rb', line 379 def hash self.class.hash ^ name.hash ^ type.hash end |
#to_json(*a) ⇒ Object
383 384 385 386 387 388 389 390 391 |
# File 'lib/rbs/ast/declarations.rb', line 383 def to_json(*a) { declaration: :global, name: name, type: type, location: location, comment: comment }.to_json(*a) end |