Sha256: e291ae5436d2d92bb1307a5e23b8dba273078f0a961bd0fcebe4717d9492d386

Contents?: true

Size: 521 Bytes

Versions: 1

Compression:

Stored size: 521 Bytes

Contents

# frozen_string_literal: true

module Kind
  class RespondTo
    include Kind::BasicObject

    def self.[](*args)
      args.each { |arg| 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

1 entries across 1 versions & 1 rubygems

Version Path
kind-5.2.0 lib/kind/objects/respond_to.rb