lib/ecoportal/api/common/content/collection_model.rb in ecoportal-api-v2-0.8.26 vs lib/ecoportal/api/common/content/collection_model.rb in ecoportal-api-v2-0.8.27

- old
+ new

@@ -189,9 +189,14 @@ (item || self[item_doc]).tap do |item| yield(item) if block_given? end end + # Deletes all the elements of this `CollectionModel` instance + def clear + self.to_a.each {|item| delete!(item)} + end + # Deletes `value` from this `CollectionModel` instance # @param value [String, Hash, Ecoportal::API::Common::Content::DoubleModel] # - When used as `String`, the `key` value (i.e. `id` value) is expected # - When used as `Hash`, it should be the `doc` of the target element # - When used as `DoubleModel`, it should be the specific object to be deleted