Module: Ramda::Internal::ClassWhichRespondTo

Included in:
Function
Defined in:
lib/ramda/internal/class_which_respond_to.rb

Overview

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

Instance Method Summary collapse

Instance Method Details

#class_which_responds_to(*method_names) ⇒ Object



6
7
8
9
10
11
12
13
14
# 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