Sha256: 8b8fe94b1a76d016cdc4d4f842f5d8c7d0b3a7794ea8d1639ff5b7c13eb7df7c

Contents?: true

Size: 527 Bytes

Versions: 10

Compression:

Stored size: 527 Bytes

Contents

# frozen_string_literal: true

module Kind
  class RespondTo
    include Kind::BasicObject

    def self.[](*args)
      args.each { |arg| STRICT.kind_of(::Symbol, arg) }

      new(args)
    end

    private_class_method :new

    attr_reader :inspect

    def initialize(method_names)
      @method_names = method_names
      @inspect = "Kind::RespondTo#{@method_names}"
    end

    def ===(value)
      KIND.interface?(@method_names, value)
    end

    alias_method :call, :===

    alias_method :name, :inspect
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
kind-5.10.0 lib/kind/objects/respond_to.rb
kind-5.9.0 lib/kind/objects/respond_to.rb
kind-5.8.1 lib/kind/objects/respond_to.rb
kind-5.8.0 lib/kind/objects/respond_to.rb
kind-5.7.0 lib/kind/objects/respond_to.rb
kind-5.6.0 lib/kind/objects/respond_to.rb
kind-5.5.0 lib/kind/objects/respond_to.rb
kind-5.4.1 lib/kind/objects/respond_to.rb
kind-5.4.0 lib/kind/objects/respond_to.rb
kind-5.3.0 lib/kind/objects/respond_to.rb