Class: RBS::AST::Declarations::Module
- Inherits:
-
Object
- Object
- RBS::AST::Declarations::Module
- 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.
-
#self_type ⇒ Object
readonly
Returns the value of attribute self_type.
-
#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_type:, annotations:, location:, comment:) ⇒ Module
constructor
A new instance of Module.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(name:, type_params:, members:, self_type:, annotations:, location:, comment:) ⇒ Module
Returns a new instance of Module.
155 156 157 158 159 160 161 162 163 |
# File 'lib/rbs/ast/declarations.rb', line 155 def initialize(name:, type_params:, members:, self_type:, annotations:, location:, comment:) @name = name @type_params = type_params @self_type = self_type @members = members @annotations = annotations @location = location @comment = comment end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
151 152 153 |
# File 'lib/rbs/ast/declarations.rb', line 151 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
153 154 155 |
# File 'lib/rbs/ast/declarations.rb', line 153 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
150 151 152 |
# File 'lib/rbs/ast/declarations.rb', line 150 def location @location end |
#members ⇒ Object (readonly)
Returns the value of attribute members.
149 150 151 |
# File 'lib/rbs/ast/declarations.rb', line 149 def members @members end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
147 148 149 |
# File 'lib/rbs/ast/declarations.rb', line 147 def name @name end |
#self_type ⇒ Object (readonly)
Returns the value of attribute self_type.
152 153 154 |
# File 'lib/rbs/ast/declarations.rb', line 152 def self_type @self_type end |
#type_params ⇒ Object (readonly)
Returns the value of attribute type_params.
148 149 150 |
# File 'lib/rbs/ast/declarations.rb', line 148 def type_params @type_params end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
165 166 167 168 169 170 171 |
# File 'lib/rbs/ast/declarations.rb', line 165 def ==(other) other.is_a?(Module) && other.name == name && other.type_params == type_params && other.self_type == self_type && other.members == members end |
#hash ⇒ Object
175 176 177 |
# File 'lib/rbs/ast/declarations.rb', line 175 def hash self.class.hash ^ name.hash ^ type_params.hash ^ self_type.hash ^ members.hash end |
#to_json(*a) ⇒ Object
179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/rbs/ast/declarations.rb', line 179 def to_json(*a) { declaration: :module, name: name, type_params: type_params, members: members, self_type: self_type, annotations: annotations, location: location, comment: comment }.to_json(*a) end |