Sha256: aa765beac5d459272b59dc5c7cae1f7360692b11c0f9d9df4210ffae8a877161

Contents?: true

Size: 477 Bytes

Versions: 2

Compression:

Stored size: 477 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(type_definition.ensure_type(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.3.0 lib/granite/form/model/attributes/collection.rb
granite-form-0.2.0 lib/granite/form/model/attributes/collection.rb