Sha256: 51adfcd9629be2720d45cbb2eb66f92a4b3e553d26cdc58ba3fb2115de2bddc6

Contents?: true

Size: 458 Bytes

Versions: 2

Compression:

Stored size: 458 Bytes

Contents

module Granite
  module Form
    module Model
      module Attributes
        class Collection < Attribute
          def read
            @value ||= normalize(read_before_type_cast.map do |value|
              enumerize(typecast(value))
            end)
          end

          def read_before_type_cast
            @value_before_type_cast ||= Array.wrap(@value_cache).map { |value| defaultize(value) }
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
granite-form-0.1.1 lib/granite/form/model/attributes/collection.rb
granite-form-0.1.0 lib/granite/form/model/attributes/collection.rb