Class: RBS::AST::Declarations::Interface
- Includes:
- MixinHelper
- 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(state = _ = nil) ⇒ Object
Methods included from MixinHelper
Constructor Details
#initialize(name:, type_params:, members:, annotations:, location:, comment:) ⇒ Interface
Returns a new instance of Interface.
328 329 330 331 332 333 334 335 |
# File 'lib/rbs/ast/declarations.rb', line 328 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.
322 323 324 |
# File 'lib/rbs/ast/declarations.rb', line 322 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
324 325 326 |
# File 'lib/rbs/ast/declarations.rb', line 324 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
323 324 325 |
# File 'lib/rbs/ast/declarations.rb', line 323 def location @location end |
#members ⇒ Object (readonly)
Returns the value of attribute members.
321 322 323 |
# File 'lib/rbs/ast/declarations.rb', line 321 def members @members end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
319 320 321 |
# File 'lib/rbs/ast/declarations.rb', line 319 def name @name end |
#type_params ⇒ Object (readonly)
Returns the value of attribute type_params.
320 321 322 |
# File 'lib/rbs/ast/declarations.rb', line 320 def type_params @type_params end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
337 338 339 340 341 342 |
# File 'lib/rbs/ast/declarations.rb', line 337 def ==(other) other.is_a?(Interface) && other.name == name && other.type_params == type_params && other.members == members end |
#hash ⇒ Object
346 347 348 |
# File 'lib/rbs/ast/declarations.rb', line 346 def hash self.class.hash ^ type_params.hash ^ members.hash end |
#to_json(state = _ = nil) ⇒ Object
350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/rbs/ast/declarations.rb', line 350 def to_json(state = _ = nil) { declaration: :interface, name: name, type_params: type_params, members: members, annotations: annotations, location: location, comment: comment }.to_json(state) end |