Sha256: 43dd44967856febe7accb2c3325dc35aa131356178771dfcca1620ef06b75af6

Contents?: true

Size: 539 Bytes

Versions: 2

Compression:

Stored size: 539 Bytes

Contents

module Para
  module ModelFieldParsers
    class Store < Para::ModelFieldParsers::Base
      register :json, self

      def parse!
        model.stored_attributes.each do |store_key, field_names|
          fields_hash.delete(store_key)

          field_names.each do |field_name|
            fields_hash[field_name] = AttributeField::Base.new(
              model, name: field_name, type: :string
            )
          end
        end
      end

      def applicable?
        !model.stored_attributes.empty?
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
para-0.5.1 lib/para/model_field_parsers/store.rb
para-0.5.0 lib/para/model_field_parsers/store.rb