Class: RBS::AST::Declarations::Class
- Inherits:
-
Object
- Object
- RBS::AST::Declarations::Class
- 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
Constructor Details
#initialize(name:, type_params:, super_class:, members:, annotations:, location:, comment:) ⇒ Class
Returns a new instance of Class.
108 109 110 111 112 113 114 115 116 |
# File 'lib/rbs/ast/declarations.rb', line 108 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.
104 105 106 |
# File 'lib/rbs/ast/declarations.rb', line 104 def annotations @annotations end |
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
106 107 108 |
# File 'lib/rbs/ast/declarations.rb', line 106 def comment @comment end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
105 106 107 |
# File 'lib/rbs/ast/declarations.rb', line 105 def location @location end |
#members ⇒ Object (readonly)
Returns the value of attribute members.
102 103 104 |
# File 'lib/rbs/ast/declarations.rb', line 102 def members @members end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
100 101 102 |
# File 'lib/rbs/ast/declarations.rb', line 100 def name @name end |
#super_class ⇒ Object (readonly)
Returns the value of attribute super_class.
103 104 105 |
# File 'lib/rbs/ast/declarations.rb', line 103 def super_class @super_class end |
#type_params ⇒ Object (readonly)
Returns the value of attribute type_params.
101 102 103 |
# File 'lib/rbs/ast/declarations.rb', line 101 def type_params @type_params end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
118 119 120 121 122 123 124 |
# File 'lib/rbs/ast/declarations.rb', line 118 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
128 129 130 |
# File 'lib/rbs/ast/declarations.rb', line 128 def hash self.class.hash ^ name.hash ^ type_params.hash ^ super_class.hash ^ members.hash end |
#to_json(*a) ⇒ Object
132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/rbs/ast/declarations.rb', line 132 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 |