In Files

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

Class/Module Index [+]

Quicksearch

RBS::TypeName

Attributes

kind[R]
name[R]
namespace[R]

Public Class Methods

new(namespace:, name:) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 8
def initialize(namespace,, name))
  @namespace = namespace
  @name = name
  @kind = case name.to_s[0,1]
          when /[A-Z]/
            :class
          when /[a-z]/
            :alias
          when "_"
            :interface
          else
            # Defaults to :class
            :class
          end
end
            

Public Instance Methods

==(other) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 24
def ==(other)
  other.is_a?(self.class) && other.namespace == namespace && other.name == name
end
            
Also aliased as: eql?
absolute!() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 54
def absolute!
  self.class.new(namespace: namespace.absolute!, name: name)
end
            
absolute?() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 58
def absolute?
  namespace.absolute?
end
            
alias?() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 50
def alias?
  kind == :alias
end
            
class?() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 46
def class?
  kind == :class
end
            
eql?(other) click to toggle source
Alias for: ==
hash() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 30
def hash
  self.class.hash ^ namespace.hash ^ name.hash
end
            
interface?() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 66
def interface?
  kind == :interface
end
            
relative!() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 62
def relative!
  self.class.new(namespace: namespace.relative!, name: name)
end
            
to_json(*a) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 38
def to_json(*a)
  to_s.to_json(*a)
end
            
to_namespace() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 42
def to_namespace
  namespace.append(self.name)
end
            
to_s() click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 34
def to_s
  "#{namespace.to_s}#{name}"
end
            
with_prefix(namespace) click to toggle source
 
               # File rbs-1.0.4/lib/rbs/type_name.rb, line 70
def with_prefix(namespace)
  self.class.new(namespace: namespace + self.namespace, name: name)
end