123456789_123456789_123456789_123456789_123456789_

Class: RBS::AST::Declarations::Module::Self

Relationships & Source Files
Inherits: Object
Defined in: lib/rbs/ast/declarations.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(name:, args:, location:) ⇒ Self

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 153

def initialize(name:, args:, location:)
  @name = name
  @args = args
  @location = location
end

Instance Attribute Details

#args (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 150

attr_reader :args

#location (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 151

attr_reader :location

#name (readonly)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 149

attr_reader :name

Instance Method Details

#==(other) Also known as: #eql?

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 159

def ==(other)
  other.is_a?(Self) && other.name == name && other.args == args
end

#eql?(other)

Alias for #==.

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 163

alias eql? ==

#hash

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 165

def hash
  self.class.hash ^ name.hash ^ args.hash ^ location.hash
end

#to_json(state = _ = nil)

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 169

def to_json(state = _ = nil)
  {
    name: name,
    args: args,
    location: location
  }.to_json(state)
end

#to_s

[ GitHub ]

  
# File 'lib/rbs/ast/declarations.rb', line 177

def to_s
  if args.empty?
    name.to_s
  else
    "#{name}[#{args.join(", ")}]"
  end
end