Class: RBS::AST::Declarations::Interface
- 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.
-
#members ⇒ Object
readonly
Returns the value of attribute members.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#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:, members:, annotations:, location:, comment:) ⇒ Interface
constructor
A new instance of Interface.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(name:, type_params:, members:, annotations:, location:, comment:) ⇒ Interface
Returns a new instance of Interface.
349 350 351 352 353 354 355 356 |
# File 'lib/rbs/ast/declarations.rb', line 349 def initialize(name:, type_params:, members:, annotations:, location:, comment:) @name = name @type_params = type_params @members = members @annotations = annotations @location = location @comment = comment end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
345 346 347 |
# File 'lib/rbs/ast/declarations.rb', line 345 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
347 348 349 |
# File 'lib/rbs/ast/declarations.rb', line 347 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
346 347 348 |
# File 'lib/rbs/ast/declarations.rb', line 346 def location @location end |
#members ⇒ Object (readonly)
Returns the value of attribute members.
344 345 346 |
# File 'lib/rbs/ast/declarations.rb', line 344 def members @members end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
342 343 344 |
# File 'lib/rbs/ast/declarations.rb', line 342 def name @name end |
#type_params ⇒ Object (readonly)
Returns the value of attribute type_params.
343 344 345 |
# File 'lib/rbs/ast/declarations.rb', line 343 def type_params @type_params end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
358 359 360 361 362 363 |
# File 'lib/rbs/ast/declarations.rb', line 358 def ==(other) other.is_a?(Interface) && other.name == name && other.type_params == type_params && other.members == members end |
#hash ⇒ Object
367 368 369 |
# File 'lib/rbs/ast/declarations.rb', line 367 def hash self.class.hash ^ type_params.hash ^ members.hash end |
#to_json(*a) ⇒ Object
371 372 373 374 375 376 377 378 379 380 381 |
# File 'lib/rbs/ast/declarations.rb', line 371 def to_json(*a) { declaration: :interface, name: name, type_params: type_params, members: members, annotations: annotations, location: location, comment: comment }.to_json(*a) end |