module Stitcher

require_relative “../stitcher”

Constants

VERSION

Public Class Methods

type_and(a, b) click to toggle source
# File lib/stitcher/type.rb, line 85
def type_and a, b
        Type.new do |other, op|
                (a.type.__send__ op, other.type) && (b.type.__send__ op, other.type)
        end
end
type_not(a) click to toggle source
# File lib/stitcher/type.rb, line 92
def type_not a
        Type.new do |other, op|
                !(a.type.__send__ op, other.type)
        end
end
type_or(a, b) click to toggle source
# File lib/stitcher/type.rb, line 77
def type_or a, b
        Type.new do |other, op|
                (a.type.__send__ op, other.type) || (b.type.__send__ op, other.type)
        end
end
type_plus_at(a) click to toggle source
# File lib/stitcher/type.rb, line 99
def type_plus_at a
        Type.new do |other, op|
                next a.type >= other if op.to_sym == :===
                a.type.__send__ op, other.type
        end
end

Private Instance Methods

type_and(a, b) click to toggle source
# File lib/stitcher/type.rb, line 85
def type_and a, b
        Type.new do |other, op|
                (a.type.__send__ op, other.type) && (b.type.__send__ op, other.type)
        end
end
type_not(a) click to toggle source
# File lib/stitcher/type.rb, line 92
def type_not a
        Type.new do |other, op|
                !(a.type.__send__ op, other.type)
        end
end
type_or(a, b) click to toggle source
# File lib/stitcher/type.rb, line 77
def type_or a, b
        Type.new do |other, op|
                (a.type.__send__ op, other.type) || (b.type.__send__ op, other.type)
        end
end
type_plus_at(a) click to toggle source
# File lib/stitcher/type.rb, line 99
def type_plus_at a
        Type.new do |other, op|
                next a.type >= other if op.to_sym == :===
                a.type.__send__ op, other.type
        end
end