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.
233 234 235 236 237 238 239 240 |
# File 'lib/rbs/ast/declarations.rb', line 233 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.
227 228 229 |
# File 'lib/rbs/ast/declarations.rb', line 227 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
229 230 231 |
# File 'lib/rbs/ast/declarations.rb', line 229 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
228 229 230 |
# File 'lib/rbs/ast/declarations.rb', line 228 def location @location end |
#members ⇒ Object (readonly)
Returns the value of attribute members.
226 227 228 |
# File 'lib/rbs/ast/declarations.rb', line 226 def members @members end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
224 225 226 |
# File 'lib/rbs/ast/declarations.rb', line 224 def name @name end |
#type_params ⇒ Object (readonly)
Returns the value of attribute type_params.
225 226 227 |
# File 'lib/rbs/ast/declarations.rb', line 225 def type_params @type_params end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
242 243 244 245 246 247 |
# File 'lib/rbs/ast/declarations.rb', line 242 def ==(other) other.is_a?(Interface) && other.name == name && other.type_params == type_params && other.members == members end |
#hash ⇒ Object
251 252 253 |
# File 'lib/rbs/ast/declarations.rb', line 251 def hash self.class.hash ^ type_params.hash ^ members.hash end |
#to_json(state = _ = nil) ⇒ Object
255 256 257 258 259 260 261 262 263 264 265 |
# File 'lib/rbs/ast/declarations.rb', line 255 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 |