Sha256: eca806ff84799b03950824abb9f0b3d5b1b6568c15841b5d9048ce03a8783413

Contents?: true

Size: 442 Bytes

Versions: 6

Compression:

Stored size: 442 Bytes

Contents

module Automigration
  class Dsl
    attr_reader :fields

    def initialize
      @fields = []
    end

    Field::KIND.each do |field|
      define_method field do |*args|
        options = args.extract_options!
        raise "wrong amount of args" unless args.size == 1
        name = args[0]
        @fields << {:name => name, :as => field.to_sym}.merge(options)
        Field.valid_options_keys(@fields.last)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
automigration-1.1.4 lib/automigration/dsl.rb
automigration-1.1.3 lib/automigration/dsl.rb
automigration-1.1.2 lib/automigration/dsl.rb
automigration-1.1.1 lib/automigration/dsl.rb
automigration-1.1.0 lib/automigration/dsl.rb
automigration-1.0.3 lib/automigration/dsl.rb