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.
236 237 238 239 240 |
# File 'lib/rbs/ast/declarations.rb', line 236 def initialize(name:, args:, location:) @name = name @args = args @location = location end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
233 234 235 |
# File 'lib/rbs/ast/declarations.rb', line 233 def args @args end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
234 235 236 |
# File 'lib/rbs/ast/declarations.rb', line 234 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
232 233 234 |
# File 'lib/rbs/ast/declarations.rb', line 232 def name @name end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
242 243 244 |
# File 'lib/rbs/ast/declarations.rb', line 242 def ==(other) other.is_a?(Self) && other.name == name && other.args == args end |
#hash ⇒ Object
248 249 250 |
# File 'lib/rbs/ast/declarations.rb', line 248 def hash self.class.hash ^ name.hash ^ args.hash ^ location.hash end |
#to_json(state = _ = nil) ⇒ Object
252 253 254 255 256 257 258 |
# File 'lib/rbs/ast/declarations.rb', line 252 def to_json(state = _ = nil) { name: name, args: args, location: location }.to_json(state) end |
#to_s ⇒ Object
260 261 262 263 264 265 266 |
# File 'lib/rbs/ast/declarations.rb', line 260 def to_s if args.empty? name.to_s else "#{name}[#{args.join(", ")}]" end end |