Sha256: d1283a9336427e691420f28318bf62fd1d9b295b814a32b68228f39962927981

Contents?: true

Size: 809 Bytes

Versions: 2

Compression:

Stored size: 809 Bytes

Contents

module Automigration
  module Fields
    module Sys
      class SliceCreater
        attr_reader :fields
        attr_reader :devise_fields

        def initialize
          @fields = []
          @devise_fields = []
        end

        Fields::Sys::Base.all.each do |field_class|
          define_method field_class.kind do |*args|
            options = args.extract_options!
            raise "wrong amount of args" unless args.size == 1
            name = args[0]
            @fields << {:name => name, :as => field_class.kind}.merge(options)
          end
        end

        def method_missing(meth, *args, &block)
          if meth.to_s =~ /^devise_(.*)/
            @devise_fields << {:as => meth, :args => args}
          else
            super
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
automigration-0.2.2 lib/automigration/fields/sys/slice_creater.rb
automigration-0.2.1 lib/automigration/fields/sys/slice_creater.rb