Module: Dry::Monads::Curry
- Defined in:
- lib/dry/monads/curry.rb
Class Method Summary collapse
Class Method Details
.call(value) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/dry/monads/curry.rb', line 8 def self.call(value) func = value.is_a?(Proc) ? value : value.method(:call) seq_args = func.parameters.count { |type, _| type.eql?(:req) || type.eql?(:opt) } seq_args += 1 if func.parameters.any? { |type, _| type.eql?(:keyreq) } if seq_args > 1 func.curry else func end end |