lib/rico/array.rb in rico-0.3.0 vs lib/rico/array.rb in rico-0.4.0

- old
+ new

@@ -30,7 +30,25 @@ obj = robject.dup obj.siblings = [obj.siblings.first] obj.data = { "_values" => result, "_deletes" => deletions } obj end + + protected + + def build_map_add(items) + { "_type" => type_key, "_values" => compute_add(items) } + end + + def build_map_remove(items) + { "_type" => type_key, "_values" => compute_remove(items), "_deletes" => items } + end + + def compute_add(items) + members + Array(items) + end + + def compute_remove(items) + members - Array(items) + end end end