Sha256: 8abec3c4b99fd2b261d285b03f320b38ac16cd19d12f0a9903ad6a5a10e5f6ff
Contents?: true
Size: 1.15 KB
Versions: 6
Compression:
Stored size: 1.15 KB
Contents
module Vedeu # Provides generic repository related behaviour. # # @api private module Store include Enumerable # @param block [Proc] # @return [Enumerator] def each(&block) storage.each(&block) end # Return a boolean indicating whether the storage is empty. # # @return [Boolean] def empty? storage.empty? end # Returns a boolean indicating whether the named model is registered. # # @param name [String] # @return [Boolean] def exists?(name) return false if empty? || name.nil? || name.empty? storage.include?(name) end alias_method :registered?, :exists? # Remove all currently stored data. # # @return [Array|Hash|Set] def reset @storage = in_memory end alias_method :reset!, :reset # Return the number of entries stored. # # @return [Fixnum] def size storage.size end # Return whole repository; provides raw access to the storage for this # repository. # # @return [Array|Hash|Set] def storage @storage ||= in_memory end alias_method :all, :storage end # Store end # Vedeu
Version data entries
6 entries across 6 versions & 1 rubygems