Class: RBS::AST::Declarations::Module
- Includes:
- MixinHelper, NestedDeclarationHelper
- Defined in:
- lib/rbs/ast/declarations.rb
Defined Under Namespace
Classes: Self
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.
-
#self_types ⇒ Object
readonly
Returns the value of attribute self_types.
-
#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:, self_types:, annotations:, location:, comment:) ⇒ Module
constructor
A new instance of Module.
- #to_json(state = _ = nil) ⇒ Object
- #update(name: self.name, type_params: self.type_params, members: self.members, self_types: self.self_types, annotations: self.annotations, location: self.location, comment: self.comment) ⇒ Object
Methods included from MixinHelper
Methods included from NestedDeclarationHelper
Constructor Details
#initialize(name:, type_params:, members:, self_types:, annotations:, location:, comment:) ⇒ Module
Returns a new instance of Module.
197 198 199 200 201 202 203 204 205 |
# File 'lib/rbs/ast/declarations.rb', line 197 def initialize(name:, type_params:, members:, self_types:, annotations:, location:, comment:) @name = name @type_params = type_params @self_types = self_types @members = members @annotations = annotations @location = location @comment = comment end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
193 194 195 |
# File 'lib/rbs/ast/declarations.rb', line 193 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
195 196 197 |
# File 'lib/rbs/ast/declarations.rb', line 195 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
192 193 194 |
# File 'lib/rbs/ast/declarations.rb', line 192 def location @location end |
#members ⇒ Object (readonly)
Returns the value of attribute members.
191 192 193 |
# File 'lib/rbs/ast/declarations.rb', line 191 def members @members end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
189 190 191 |
# File 'lib/rbs/ast/declarations.rb', line 189 def name @name end |
#self_types ⇒ Object (readonly)
Returns the value of attribute self_types.
194 195 196 |
# File 'lib/rbs/ast/declarations.rb', line 194 def self_types @self_types end |
#type_params ⇒ Object (readonly)
Returns the value of attribute type_params.
190 191 192 |
# File 'lib/rbs/ast/declarations.rb', line 190 def type_params @type_params end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
220 221 222 223 224 225 226 |
# File 'lib/rbs/ast/declarations.rb', line 220 def ==(other) other.is_a?(Module) && other.name == name && other.type_params == type_params && other.self_types == self_types && other.members == members end |
#hash ⇒ Object
230 231 232 |
# File 'lib/rbs/ast/declarations.rb', line 230 def hash self.class.hash ^ name.hash ^ type_params.hash ^ self_types.hash ^ members.hash end |
#to_json(state = _ = nil) ⇒ Object
234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/rbs/ast/declarations.rb', line 234 def to_json(state = _ = nil) { declaration: :module, name: name, type_params: type_params, members: members, self_types: self_types, annotations: annotations, location: location, comment: comment }.to_json(state) end |
#update(name: self.name, type_params: self.type_params, members: self.members, self_types: self.self_types, annotations: self.annotations, location: self.location, comment: self.comment) ⇒ Object
207 208 209 210 211 212 213 214 215 216 217 |
# File 'lib/rbs/ast/declarations.rb', line 207 def update(name: self.name, type_params: self.type_params, members: self.members, self_types: self.self_types, annotations: self.annotations, location: self.location, comment: self.comment) self.class.new( name: name, type_params: type_params, members: members, self_types: self_types, annotations: annotations, location: location, comment: comment ) end |