Class: RBS::AST::Declarations::Module::Self
- Inherits:
-
Object
- Object
- RBS::AST::Declarations::Module::Self
- Defined in:
- lib/rbs/ast/declarations.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #hash ⇒ Object
-
#initialize(name:, args:, location:) ⇒ Self
constructor
A new instance of Self.
- #to_json(state = _ = nil) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name:, args:, location:) ⇒ Self
Returns a new instance of Self.
141 142 143 144 145 |
# File 'lib/rbs/ast/declarations.rb', line 141 def initialize(name:, args:, location:) @name = name @args = args @location = location end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
138 139 140 |
# File 'lib/rbs/ast/declarations.rb', line 138 def args @args end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
139 140 141 |
# File 'lib/rbs/ast/declarations.rb', line 139 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
137 138 139 |
# File 'lib/rbs/ast/declarations.rb', line 137 def name @name end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
147 148 149 |
# File 'lib/rbs/ast/declarations.rb', line 147 def ==(other) other.is_a?(Self) && other.name == name && other.args == args end |
#hash ⇒ Object
153 154 155 |
# File 'lib/rbs/ast/declarations.rb', line 153 def hash self.class.hash ^ name.hash ^ args.hash ^ location.hash end |
#to_json(state = _ = nil) ⇒ Object
157 158 159 160 161 162 163 |
# File 'lib/rbs/ast/declarations.rb', line 157 def to_json(state = _ = nil) { name: name, args: args, location: location }.to_json(state) end |
#to_s ⇒ Object
165 166 167 168 169 170 171 |
# File 'lib/rbs/ast/declarations.rb', line 165 def to_s if args.empty? name.to_s else "#{name}[#{args.join(", ")}]" end end |