lib/mixture/coerce/object.rb in mixture-0.1.0 vs lib/mixture/coerce/object.rb in mixture-0.2.0

- old
+ new

@@ -4,9 +4,13 @@ module Coerce # Handles coercion of the Object class. class Object < Base type Type::Object + # Tries a set of methods on the object, before failing with a + # coercion error. + # + # @return [Proc{(Symbol) => Proc{(Object) => Object}}] TryMethods = proc do |*methods| proc do |value| method = methods.find { |m| value.respond_to?(m) } if method value.public_send(method)