class Stitcher::Type

Public Class Methods

new(klass = nil, &block) click to toggle source
# File lib/stitcher/type.rb, line 52
def initialize klass = nil, &block
        @comp = block
        @comp = lambda do |other, op|
                # change operator "<" to ">".
                return other.comp(klass, op.to_s.tr("<>", "><"))  if other.class == Type
                return self.comp(other, :==) if op.to_sym == :===
                klass.__send__ op, other.classtype
        end unless block_given?
end

Public Instance Methods

comp(other, op) click to toggle source
# File lib/stitcher/type.rb, line 62
def comp other, op
        !!@comp.(other, op)
end
type() click to toggle source
# File lib/stitcher/type.rb, line 72
def type
        self
end