Class: 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.
-
#type_params ⇒ Object
readonly
Returns the value of attribute type_params.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, type_params:, type:, annotations:, location:, comment:) ⇒ Alias
constructor
A new instance of Alias.
- #to_json(state = _ = nil) ⇒ Object
Constructor Details
#initialize(name:, type_params:, type:, annotations:, location:, comment:) ⇒ Alias
Returns a new instance of Alias.
276 277 278 279 280 281 282 283 |
# File 'lib/rbs/ast/declarations.rb', line 276 def initialize(name:, type_params:, type:, annotations:, location:, comment:) @name = name @type_params = type_params @type = type @annotations = annotations @location = location @comment = comment end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
272 273 274 |
# File 'lib/rbs/ast/declarations.rb', line 272 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
274 275 276 |
# File 'lib/rbs/ast/declarations.rb', line 274 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
273 274 275 |
# File 'lib/rbs/ast/declarations.rb', line 273 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
269 270 271 |
# File 'lib/rbs/ast/declarations.rb', line 269 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
271 272 273 |
# File 'lib/rbs/ast/declarations.rb', line 271 def type @type end |
#type_params ⇒ Object (readonly)
Returns the value of attribute type_params.
270 271 272 |
# File 'lib/rbs/ast/declarations.rb', line 270 def type_params @type_params end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
285 286 287 288 289 290 |
# File 'lib/rbs/ast/declarations.rb', line 285 def ==(other) other.is_a?(Alias) && other.name == name && other.type_params == type_params && other.type == type end |
#hash ⇒ Object
294 295 296 |
# File 'lib/rbs/ast/declarations.rb', line 294 def hash self.class.hash ^ name.hash ^ type_params.hash ^ type.hash end |
#to_json(state = _ = nil) ⇒ Object
298 299 300 301 302 303 304 305 306 307 308 |
# File 'lib/rbs/ast/declarations.rb', line 298 def to_json(state = _ = nil) { declaration: :alias, name: name, type_params: type_params, type: type, annotations: annotations, location: location, comment: comment }.to_json(state) end |