Class: RBS::AST::Declarations::Class
- Includes:
- MixinHelper, NestedDeclarationHelper
- Defined in:
- lib/rbs/ast/declarations.rb
Defined Under Namespace
Classes: Super
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.
-
#super_class ⇒ Object
readonly
Returns the value of attribute super_class.
-
#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:, super_class:, members:, annotations:, location:, comment:) ⇒ Class
constructor
A new instance of Class.
- #to_json(*a) ⇒ Object
Methods included from MixinHelper
Methods included from NestedDeclarationHelper
Constructor Details
#initialize(name:, type_params:, super_class:, members:, annotations:, location:, comment:) ⇒ Class
Returns a new instance of Class.
174 175 176 177 178 179 180 181 182 |
# File 'lib/rbs/ast/declarations.rb', line 174 def initialize(name:, type_params:, super_class:, members:, annotations:, location:, comment:) @name = name @type_params = type_params @super_class = super_class @members = members @annotations = annotations @location = location @comment = comment end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
170 171 172 |
# File 'lib/rbs/ast/declarations.rb', line 170 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
172 173 174 |
# File 'lib/rbs/ast/declarations.rb', line 172 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
171 172 173 |
# File 'lib/rbs/ast/declarations.rb', line 171 def location @location end |
#members ⇒ Object (readonly)
Returns the value of attribute members.
168 169 170 |
# File 'lib/rbs/ast/declarations.rb', line 168 def members @members end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
166 167 168 |
# File 'lib/rbs/ast/declarations.rb', line 166 def name @name end |
#super_class ⇒ Object (readonly)
Returns the value of attribute super_class.
169 170 171 |
# File 'lib/rbs/ast/declarations.rb', line 169 def super_class @super_class end |
#type_params ⇒ Object (readonly)
Returns the value of attribute type_params.
167 168 169 |
# File 'lib/rbs/ast/declarations.rb', line 167 def type_params @type_params end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
184 185 186 187 188 189 190 |
# File 'lib/rbs/ast/declarations.rb', line 184 def ==(other) other.is_a?(Class) && other.name == name && other.type_params == type_params && other.super_class == super_class && other.members == members end |
#hash ⇒ Object
194 195 196 |
# File 'lib/rbs/ast/declarations.rb', line 194 def hash self.class.hash ^ name.hash ^ type_params.hash ^ super_class.hash ^ members.hash end |
#to_json(*a) ⇒ Object
198 199 200 201 202 203 204 205 206 207 208 209 |
# File 'lib/rbs/ast/declarations.rb', line 198 def to_json(*a) { declaration: :class, name: name, type_params: type_params, members: members, super_class: super_class, annotations: annotations, location: location, comment: comment }.to_json(*a) end |