lib/kind.rb in kind-1.3.0 vs lib/kind.rb in kind-1.4.0
- old
+ new
@@ -1,10 +1,10 @@
# frozen_string_literal: true
require 'kind/version'
require 'kind/undefined'
-require 'kind/optional'
+require 'kind/maybe'
require 'kind/error'
require 'kind/is'
require 'kind/checker'
require 'kind/of'
require 'kind/types'
@@ -99,11 +99,11 @@
def self.Callable(object = Undefined, options = {})
default = options[:or]
return Kind::Of::Callable if object == Undefined && default.nil?
- callable = object.nil? ? default : object
+ callable = object || default
return callable if callable.respond_to?(:call)
raise Kind::Error.new('Callable'.freeze, callable)
end
@@ -111,10 +111,12 @@
const_set(:Callable, ::Module.new do
extend Checker
def self.__kind; Object; end
- def self.class?(value); Kind::Is::Callable(value); end
+ def self.class?(value)
+ Kind::Is::Callable(value)
+ end
def self.instance?(value);
value.respond_to?(:call)
end
end)