In Files

  • typeprof-0.12.0/lib/typeprof/type.rb

Class/Module Index [+]

Quicksearch

Instance

Attributes

klass[R]

Public Class Methods

new(klass) click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/type.rb, line 516
def initialize(klass)
  raise unless klass
  raise if klass == Type.any
  raise if klass.is_a?(Type::Instance)
  raise if klass.is_a?(Type::Union)
  @klass = klass
end
            

Public Instance Methods

consistent?(other) click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/type.rb, line 544
def consistent?(other)
  case other
  when Type::Instance
    @klass.consistent?(other.klass)
  when Type::Class
    return true if @klass == Type::Builtin[:obj] || @klass == Type::Builtin[:class] || @klass == Type::Builtin[:module]
    return false
  else
    false
  end
end
            
inspect() click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/type.rb, line 526
def inspect
  "I[#{ @klass.inspect }]"
end
            
method_dispatch_info() click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/type.rb, line 540
def method_dispatch_info
  [@klass, false]
end
            
screen_name(scratch) click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/type.rb, line 530
def screen_name(scratch)
  case @klass
  when Type::Builtin[:nil] then "nil"
  when Type::Builtin[:true] then "true"
  when Type::Builtin[:false] then "false"
  else
    scratch.get_class_name(@klass)
  end
end
            
substitute(subst, depth) click to toggle source
 
               # File typeprof-0.12.0/lib/typeprof/type.rb, line 556
def substitute(subst, depth)
  Instance.new(@klass.substitute(subst, depth))
end