Class: Mixture::Coerce::Object
- Defined in:
- lib/mixture/coerce/object.rb
Overview
Handles coercion of the Object class.
Constant Summary collapse
- TryMethods =
Tries a set of methods on the object, before failing with a coercion error.
proc do |*methods| proc do |value| method = methods.find { |m| value.respond_to?(m) } fail CoercionError, "Could not coerce #{value.class}" unless method value.public_send(method) end end