Module: ClassyFilter::Coercions

Extended by:
Coercions
Included in:
Coercions
Defined in:
lib/classy_filter/coercions.rb

Instance Method Summary collapse

Instance Method Details

#coerce(value, coercion) ⇒ Object



5
6
7
8
9
10
# File 'lib/classy_filter/coercions.rb', line 5

def coerce(value, coercion)
  case coercion
  when Symbol then send(coercion, value)
  when ->(x) { x.respond_to?(:call) } then coercion.call(value)
  end
end