Sha256: 0e4b8af741fdabbf45d27f329b249e57dc6c540561aa6618e4013e9d15837a94

Contents?: true

Size: 569 Bytes

Versions: 5

Compression:

Stored size: 569 Bytes

Contents

module PR
  module Form

    def self.included other
      other.send :extend,  DSL
      other.send :include, Macros
    end

    module DSL
      def field name, type, options = {}
        PR::DefineAndRegister[ self, name, type, options ]
      end
      def from_hash hash, *args
        form = new *args
        PR::BuildFromHash[ form, hash ]
        form
      end
      def from_model model
        PR::BuildFromModel[ self, model ]
      end
    end

    module Macros
      def build_model model
        BuildModel[ self, model ]
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pr-1.0.0 lib/pr/form.rb
pr-0.0.7 lib/pr/form.rb
pr-0.0.6 lib/pr/form.rb
pr-0.0.5 lib/pr/form.rb
pr-0.0.4 lib/pr/form.rb