Module: Welder::Support::CallableHandler
- Included in:
- Pipeline
- Defined in:
- lib/welder/support/callable_handler.rb
Overview
Mixin that provides several utilities to handle callable objects
Instance Method Summary collapse
-
#callable!(*lambdas) ⇒ Object
Assert that a series of values are callable (respond to call).
Instance Method Details
#callable!(*lambdas) ⇒ Object
Assert that a series of values are callable (respond to call)
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/welder/support/callable_handler.rb', line 15 def callable!(*lambdas) non_callable = lambdas.reject { |lambda| lambda.respond_to?(:call) } unless non_callable.empty? raise( CallableExpectedError, "Expected #{non_callable.map(&:to_s).join(', ')} " \ "to respond to 'call'" ) end end |