In Files

  • rbs-1.0.4/lib/rbs/types.rb

Class/Module Index [+]

Quicksearch

RBS::Types::Bases::Base

Attributes

location[R]

Public Class Methods

new(location:) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/types.rb, line 36
def initialize(location))
  @location = location
end
            

Public Instance Methods

==(other) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/types.rb, line 40
def ==(other)
  other.is_a?(self.class)
end
            
Also aliased as: eql?
eql?(other) click to toggle source
Alias for: ==
hash() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/types.rb, line 44
def hash
  self.class.hash
end
            
to_json(*a) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/types.rb, line 55
def to_json(*a)
  klass = to_s.to_sym
  { class: klass, location: location }.to_json(*a)
end
            
to_s(level = 0) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/types.rb, line 60
def to_s(level = 0)
  case self
  when Types::Bases::Bool
    'bool'
  when Types::Bases::Void
    'void'
  when Types::Bases::Any
    'untyped'
  when Types::Bases::Nil
    'nil'
  when Types::Bases::Top
    'top'
  when Types::Bases::Bottom
    'bot'
  when Types::Bases::Self
    'self'
  when Types::Bases::Instance
    'instance'
  when Types::Bases::Class
    'class'
  else
    raise "Unexpected base type: #{inspect}"
  end
end