Sha256: f6caa1e751e1ed9dcc1b31d96dd0836035f751a4ae4f56da0fdb622c017e4db0
Contents?: true
Size: 847 Bytes
Versions: 2
Compression:
Stored size: 847 Bytes
Contents
module Granite module Form module Model module Attributes class Dictionary < Attribute delegate :keys, to: :reflection def read @value ||= begin hash = read_before_type_cast hash = hash.stringify_keys.slice(*keys) if keys.present? normalize(Hash[hash.map do |key, value| [key, enumerize(typecast(value))] end].with_indifferent_access).with_indifferent_access end end def read_before_type_cast @value_before_type_cast ||= Hash[(@value_cache.presence || {}).map do |key, value| [key, defaultize(value)] end].with_indifferent_access 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/dictionary.rb |
granite-form-0.1.0 | lib/granite/form/model/attributes/dictionary.rb |