lib/vedeu/storage/store.rb in vedeu-0.4.46 vs lib/vedeu/storage/store.rb in vedeu-0.4.47
- old
+ new
@@ -29,16 +29,31 @@
storage.include?(name)
end
alias_method :registered?, :exists?
+ # Returns a collection of the names of all the registered entities.
+ #
+ # @return [Array]
+ def registered
+ return [] if empty?
+ return storage.keys if storage.is_a?(Hash)
+ return storage.to_a if storage.is_a?(Set)
+
+ storage
+ end
+
# Remove all currently stored data.
#
# @return [Array|Hash|Set]
def reset
+ Vedeu.log(type: :reset,
+ message: "(#{self.class.name}) #{registered.inspect}")
+
@storage = in_memory
end
alias_method :reset!, :reset
+ alias_method :clear, :reset
# Return the number of entries stored.
#
# @return [Fixnum]
def size