lib/kind.rb in kind-1.7.0 vs lib/kind.rb in kind-1.8.0
- old
+ new
@@ -86,11 +86,11 @@
def self.__kind; ::Class; end
def self.class?(value); Kind::Is.Class(value); end
- def self.instance?(value); class?(value); end
+ def self.__is_instance__(value); class?(value); end
end)
# -- Module
def self.Module(object = Undefined)
@@ -126,17 +126,17 @@
default = options[:or]
if ::Kind::Maybe::Value.none?(default)
__kind_undefined(value) { __kind_of(value) }
else
- return value if instance?(value)
+ return value if value != Kind::Undefined && instance?(value)
__kind_undefined(default) { __kind_of(default) }
end
end
- def self.instance?(value); class?(value); end
+ def self.__is_instance__(value); class?(value); end
end)
# -- Boolean
def self.Boolean(object = Undefined, options = Empty::HASH)
@@ -162,11 +162,11 @@
default = options[:or]
if ::Kind::Maybe::Value.none?(default)
__kind_undefined(value) { Kind::Of::Boolean(value) }
else
- return value if instance?(value)
+ return value if value != Kind::Undefined && instance?(value)
__kind_undefined(default) { Kind::Of::Boolean(default) }
end
end
@@ -176,11 +176,11 @@
else
yield
end
end
- def self.instance?(value);
+ def self.__is_instance__(value);
value.is_a?(TrueClass) || value.is_a?(FalseClass)
end
def self.or_undefined(value)
result = or_nil(value)
@@ -211,11 +211,11 @@
default = options[:or]
if ::Kind::Maybe::Value.none?(default)
__kind_undefined(value) { Kind::Of::Lambda(value) }
else
- return value if instance?(value)
+ return value if value != Kind::Undefined && instance?(value)
__kind_undefined(default) { Kind::Of::Lambda(default) }
end
end
@@ -225,11 +225,11 @@
else
yield
end
end
- def self.instance?(value)
+ def self.__is_instance__(value)
value.is_a?(__kind) && value.lambda?
end
end)
# -- Callable
@@ -259,11 +259,11 @@
default = options[:or]
if ::Kind::Maybe::Value.none?(default)
__kind_undefined(value) { Kind::Of::Callable(value) }
else
- return value if instance?(value)
+ return value if value != Kind::Undefined && instance?(value)
__kind_undefined(default) { Kind::Of::Callable(default) }
end
end
@@ -273,10 +273,10 @@
else
yield
end
end
- def self.instance?(value);
+ def self.__is_instance__(value);
value.respond_to?(:call)
end
end)
# ---------------------- #