lib/virtus/configuration.rb in virtus-1.0.0.beta8 vs lib/virtus/configuration.rb in virtus-1.0.0.rc1

- old
+ new

@@ -26,12 +26,14 @@ # end # # @return [Configuration] # # @api public - def self.build(&block) - new.call(&block) + def self.build(options = {}, &block) + config = new.call(&block) + options.each { |key, value| config.public_send("#{key}=", value) } + config end # Initialized a configuration instance # # @return [undefined] @@ -73,9 +75,17 @@ # # @api private def coercer(&block) @coercer = Coercible::Coercer.new(&block) if block_given? @coercer + end + + # @api private + def to_h + { :coerce => coerce, + :finalize => finalize, + :strict => strict, + :configured_coercer => coercer }.freeze end end # class Configuration end # module Virtus