Sha256: 161b38ac29c93dbe0bace30d02b38d2b0133d20813f31ccea6ddb8abe060efd1

Contents?: true

Size: 397 Bytes

Versions: 10

Compression:

Stored size: 397 Bytes

Contents

# frozen_string_literal: true

module Kind
  module Is
    def self.call(expected, object)
      __call__(Kind::Of.Module(expected), object)
    end

    def self.__call__(expected_kind, object)
      kind = Kind::Of.Module(object)

      if kind.is_a?(Class)
        kind <= expected_kind || false
      else
        kind == expected_kind || kind.is_a?(expected_kind)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
kind-3.1.0 lib/kind/is.rb
kind-3.0.1 lib/kind/is.rb
kind-3.0.0 lib/kind/is.rb
kind-2.3.0 lib/kind/is.rb
kind-2.2.0 lib/kind/is.rb
kind-2.1.0 lib/kind/is.rb
kind-2.0.0 lib/kind/is.rb
kind-1.9.0 lib/kind/is.rb
kind-1.8.0 lib/kind/is.rb
kind-1.7.0 lib/kind/is.rb