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 141

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 138

attr_reader :args

#location (readonly)

[ GitHub ]

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

attr_reader :location

#name (readonly)

[ GitHub ]

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

attr_reader :name

Instance Method Details

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

[ GitHub ]

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

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

#eql?(other)

[ GitHub ]

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

alias eql? ==

#hash

[ GitHub ]

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

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

#to_json(state = _ = nil)

[ GitHub ]

  
# 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

[ GitHub ]

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

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