Module: Ramda::Internal::Java::MakeCurryProc

Included in:
Ramda
Defined in:
lib/ramda/internal/java/__make_curry_proc__.rb

Overview

This hack resolved issue:

undefined method `__make_curry_proc__' for Ramda::Math:Module

Source:

https://github.com/jruby/jruby/issues/1523

Instance Method Summary collapse

Instance Method Details

#__make_curry_proc__(proc, passed, arity) ⇒ Object

rubocop:disable Metrics/MethodLength



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ramda/internal/java/__make_curry_proc__.rb', line 12

def __make_curry_proc__(proc, passed, arity)
  is_lambda = proc.lambda?
  passed.freeze

  __send__((is_lambda ? :lambda : :proc)) do |*argv, &passed_proc|
    my_passed = passed + argv
    # original
    # if my_passed.length < arity
    # changed
    if my_passed.length < arity.abs - 1
      warn "#{caller[0]}: given block not used" unless passed_proc.nil?
      __make_curry_proc__(proc, my_passed, arity)
    else
      proc.call(*my_passed)
    end
  end
end