Sha256: d778ab3295f819d2c625fe17362e91721ccf45e7da691cb43cd7297ce258d7c9

Contents?: true

Size: 752 Bytes

Versions: 11

Compression:

Stored size: 752 Bytes

Contents

# Include this in every module that gets further included.
module Reform::Form::Module # Schema
  def self.included(base)
    base.extend ClassMethods
    base.extend Included
  end

  module Included # TODO: use representable's inheritance mechanism.
    def included(base)
      super
      instructions.each { |cfg|
        args    = cfg[1].dup
        options = args.extract_options!.dup # we need to duplicate options has as AM::Validations messes it up later.

        base.send(cfg[0], *args, options, &cfg[2]) } # property :name, {} do .. end
    end
  end

  module ClassMethods
    def method_missing(method, *args, &block)
      instructions << [method, args, block]
    end

    def instructions
      @instructions ||= []
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
reform-2.0.0.beta2 lib/reform/form/module.rb
reform-2.0.0.beta1 lib/reform/form/module.rb
reform-1.2.6 lib/reform/form/module.rb
reform-1.2.5 lib/reform/form/module.rb
reform-1.2.4 lib/reform/form/module.rb
reform-1.2.3 lib/reform/form/module.rb
reform-1.2.2 lib/reform/form/module.rb
reform-1.2.1 lib/reform/form/module.rb
reform-1.2.0.beta2 lib/reform/form/module.rb
reform-1.2.0.beta1 lib/reform/form/module.rb
reform-1.1.1 lib/reform/form/module.rb