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(*a) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name:, args:, location:) ⇒ Self
Returns a new instance of Self.
221 222 223 224 225 |
# File 'lib/rbs/ast/declarations.rb', line 221 def initialize(name:, args:, location:) @name = name @args = args @location = location end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
218 219 220 |
# File 'lib/rbs/ast/declarations.rb', line 218 def args @args end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
219 220 221 |
# File 'lib/rbs/ast/declarations.rb', line 219 def location @location end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
217 218 219 |
# File 'lib/rbs/ast/declarations.rb', line 217 def name @name end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
227 228 229 |
# File 'lib/rbs/ast/declarations.rb', line 227 def ==(other) other.is_a?(Self) && other.name == name && other.args == args end |
#hash ⇒ Object
233 234 235 |
# File 'lib/rbs/ast/declarations.rb', line 233 def hash self.class.hash ^ name.hash ^ args.hash ^ location.hash end |
#to_json(*a) ⇒ Object
237 238 239 240 241 242 243 |
# File 'lib/rbs/ast/declarations.rb', line 237 def to_json(*a) { name: name, args: args, location: location }.to_json(*a) end |
#to_s ⇒ Object
245 246 247 248 249 250 251 |
# File 'lib/rbs/ast/declarations.rb', line 245 def to_s if args.empty? name.to_s else "#{name}[#{args.join(", ")}]" end end |