lib/virtus/module_builder.rb in virtus-1.0.0.beta7 vs lib/virtus/module_builder.rb in virtus-1.0.0.beta8

- old
+ new

@@ -42,10 +42,15 @@ builder.add_included_hook builder.add_extended_hook builder.module end + # @api private + def self.pending + @pending ||= [] + end + # Initializes a new ModuleBuilder # # @param [Configuration] configuration # # @param [Module] mod @@ -66,15 +71,17 @@ # @api private def add_included_hook attribute_proc = attribute_method(configuration) constructor = configuration.constructor mass_assignment = configuration.mass_assignment + finalize = configuration.finalize extensions = core_extensions inclusions = core_inclusions self.module.define_singleton_method :included do |object| super(object) + ExtensionBuilder.pending << object unless finalize extensions.each { |mod| object.extend(mod) } inclusions.each { |mod| object.send(:include, mod) } object.send(:include, Model::Constructor) if constructor object.send(:include, Model::MassAssignment) if mass_assignment object.send(:define_singleton_method, :attribute, attribute_proc) @@ -112,9 +119,10 @@ end # @api private def module_options { :coerce => configuration.coerce, + :finalize => configuration.finalize, :strict => configuration.strict, :configured_coercer => configuration.coercer } end # @api private