Sha256: e521e16aa2271fbeb57eb09a05e9b46367c22059fdbb3d98b4381176098259f9
Contents?: true
Size: 1.18 KB
Versions: 3
Compression:
Stored size: 1.18 KB
Contents
module Fire class SingleNestedModel < NestedModel class << self def has_path_keys(*keys) raise PathKeysNotSupported.new(self) end def folder_content(parent) init_empty_parent_object(parent) parent_original = parent.send(folder) new(parent_original.clone.merge(parent.path_data), parent_original) end def id_key parent.id_key end def set_id_key(value) raise IdKeyNotSupported.new(self) end protected def default_path_keys [] end def default_folder_name name end def init_empty_parent_object(parent) unless parent.send(folder) parent.send("#{folder}=", {}) end end def validate_id_key! true end end class IdKeyNotSupported < FireModelError def initialize(single_nested_model) super("Single Model #{single_nested_model} don't support own ID key.") end end class PathKeysNotSupported < FireModelError def initialize(single_nested_model) super("Single Model #{single_nested_model} don't support own path keys.") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
fire-model-0.0.18 | lib/model/nested/single.rb |
fire-model-0.0.17 | lib/model/nested/single.rb |
fire-model-0.0.16 | lib/model/nested/single.rb |