Class: RBS::AST::Declarations::Extension
- Inherits:
-
Object
- Object
- RBS::AST::Declarations::Extension
- 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.
-
#extension_name ⇒ Object
readonly
Returns the value of attribute extension_name.
-
#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:, extension_name:, members:, annotations:, location:, comment:) ⇒ Extension
constructor
A new instance of Extension.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(name:, type_params:, extension_name:, members:, annotations:, location:, comment:) ⇒ Extension
Returns a new instance of Extension.
210 211 212 213 214 215 216 217 218 |
# File 'lib/rbs/ast/declarations.rb', line 210 def initialize(name:, type_params:, extension_name:, members:, annotations:, location:, comment:) @name = name @type_params = type_params @extension_name = extension_name @members = members @annotations = annotations @location = location @comment = comment end |
Instance Attribute Details
#annotations ⇒ Object (readonly)
Returns the value of attribute annotations.
206 207 208 |
# File 'lib/rbs/ast/declarations.rb', line 206 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
208 209 210 |
# File 'lib/rbs/ast/declarations.rb', line 208 def comment @comment end |
#extension_name ⇒ Object (readonly)
Returns the value of attribute extension_name.
204 205 206 |
# File 'lib/rbs/ast/declarations.rb', line 204 def extension_name @extension_name end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
207 208 209 |
# File 'lib/rbs/ast/declarations.rb', line 207 def location @location end |
#members ⇒ Object (readonly)
Returns the value of attribute members.
205 206 207 |
# File 'lib/rbs/ast/declarations.rb', line 205 def members @members end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
202 203 204 |
# File 'lib/rbs/ast/declarations.rb', line 202 def name @name end |
#type_params ⇒ Object (readonly)
Returns the value of attribute type_params.
203 204 205 |
# File 'lib/rbs/ast/declarations.rb', line 203 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?(Extension) && other.name == name && other.type_params == type_params && other.extension_name == extension_name && 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 ^ extension_name.hash ^ members.hash end |
#to_json(*a) ⇒ Object
234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/rbs/ast/declarations.rb', line 234 def to_json(*a) { declaration: :extension, name: name, type_params: type_params, extension_name: extension_name, members: members, annotations: annotations, location: location, comment: comment }.to_json(*a) end |