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.
290 291 292 293 294 295 296 |
# File 'lib/rbs/ast/declarations.rb', line 290 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.
286 287 288 |
# File 'lib/rbs/ast/declarations.rb', line 286 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
288 289 290 |
# File 'lib/rbs/ast/declarations.rb', line 288 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
287 288 289 |
# File 'lib/rbs/ast/declarations.rb', line 287 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
284 285 286 |
# File 'lib/rbs/ast/declarations.rb', line 284 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
285 286 287 |
# File 'lib/rbs/ast/declarations.rb', line 285 def type @type end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
298 299 300 301 302 |
# File 'lib/rbs/ast/declarations.rb', line 298 def ==(other) other.is_a?(Alias) && other.name == name && other.type == type end |
#hash ⇒ Object
306 307 308 |
# File 'lib/rbs/ast/declarations.rb', line 306 def hash self.class.hash ^ name.hash ^ type.hash end |
#to_json(*a) ⇒ Object
310 311 312 313 314 315 316 317 318 319 |
# File 'lib/rbs/ast/declarations.rb', line 310 def to_json(*a) { declaration: :alias, name: name, type: type, annotations: annotations, location: location, comment: comment }.to_json(*a) end |