module Ramda::Internal::ClassWhichRespondTo

Defines a class which responds to method and can be used in case construction for equality check.

Public Class Methods

===(other) click to toggle source
# File lib/ramda/internal/class_which_respond_to.rb, line 10
def self.===(other)
  @method_names.find(&other.method(:respond_to?))
end

Public Instance Methods

class_which_responds_to(*method_names) click to toggle source
# File lib/ramda/internal/class_which_respond_to.rb, line 6
def class_which_responds_to(*method_names)
  Class.new do
    @method_names = method_names

    def self.===(other)
      @method_names.find(&other.method(:respond_to?))
    end
  end
end