Module: Stitcher

Includes:
Accessor, Require, Stitch
Defined in:
lib/stitcher.rb,
lib/stitcher/core.rb,
lib/stitcher/type.rb,
lib/stitcher/type.rb,
lib/stitcher/type.rb,
lib/stitcher/stitch.rb,
lib/stitcher/require.rb,
lib/stitcher/version.rb,
lib/stitcher/accessor.rb,
lib/stitcher/concepts.rb,
lib/stitcher/register.rb,
lib/stitcher/operators.rb,
lib/stitcher/define_method.rb,
lib/stitcher/variadic_argument.rb

Defined Under Namespace

Modules: Accessor, Concepts, Core, DefineMethod, Operators, Refinements, Register, Require, Stitch, TypeOperators, VariadicArgument Classes: Type

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Methods included from Require

method_added, #stitcher_require

Methods included from Register

define_call_method, register, #stitcher_register

Methods included from Stitch

#stitch

Methods included from DefineMethod

as_instance_executable, #stitcher_define_method

Methods included from Accessor

#stitcher_accessor, #stitcher_writer

Class Method Details

.type_and(a, b) ⇒ Object



85
86
87
88
89
# 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) ⇒ Object



92
93
94
95
96
# 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) ⇒ Object



77
78
79
80
81
# 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) ⇒ Object



99
100
101
102
103
104
# 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