Module: Enumerize::Utils

Defined in:
lib/enumerize/utils.rb

Class Method Summary collapse

Class Method Details

.call_if_callable(value, param = nil) ⇒ Object


6
7
8
9
# File 'lib/enumerize/utils.rb', line 6

def call_if_callable(value, param = nil)
  return value unless value.respond_to?(:call)
  value.arity == 0 ? value.call : value.call(param)
end