Class: RBS::AST::Declarations::Alias
- Inherits:
-
Object
- Object
- 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.
298 299 300 301 302 303 304 |
# File 'lib/rbs/ast/declarations.rb', line 298 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.
294 295 296 |
# File 'lib/rbs/ast/declarations.rb', line 294 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
296 297 298 |
# File 'lib/rbs/ast/declarations.rb', line 296 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
295 296 297 |
# File 'lib/rbs/ast/declarations.rb', line 295 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
292 293 294 |
# File 'lib/rbs/ast/declarations.rb', line 292 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
293 294 295 |
# File 'lib/rbs/ast/declarations.rb', line 293 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
306 307 308 309 310 |
# File 'lib/rbs/ast/declarations.rb', line 306 def ==(other) other.is_a?(Alias) && other.name == name && other.type == type end |
#hash ⇒ Object
314 315 316 |
# File 'lib/rbs/ast/declarations.rb', line 314 def hash self.class.hash ^ name.hash ^ type.hash end |
#to_json(*a) ⇒ Object
318 319 320 321 322 323 324 325 326 327 |
# File 'lib/rbs/ast/declarations.rb', line 318 def to_json(*a) { declaration: :alias, name: name, type: type, annotations: annotations, location: location, comment: comment }.to_json(*a) end |