Sha256: ece804ef18e00383a8a9f7b0d7d056c9da5e64357d1250bf3b8d2aad26185205

Contents?: true

Size: 752 Bytes

Versions: 11

Compression:

Stored size: 752 Bytes

Contents

module Vedeu

  # Provides all registered repositories.
  #
  module Repositories

    extend self

    # @param klass [Class]
    # @return [Set]
    def register(klass)
      storage.add(klass)
    end

    # Remove all stored models from the repository.
    #
    # @return [TrueClass]
    def reset!
      storage.map(&:repository).map { |repository| repository.send(:reset) }

      true
    end

    private

    # Access to the storage for this repository.
    #
    # @return [Array]
    def storage
      @storage ||= Set.new
    end

  end

end # Vedeu

require_relative 'registerable'
require_relative 'collection'
require_relative 'collections/all'
require_relative 'model'
require_relative 'repositories/all'
require_relative 'repository'

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
vedeu-0.4.29 lib/vedeu/repositories/all.rb
vedeu-0.4.28 lib/vedeu/repositories/all.rb
vedeu-0.4.27 lib/vedeu/repositories/all.rb
vedeu-0.4.26 lib/vedeu/repositories/all.rb
vedeu-0.4.25 lib/vedeu/repositories/all.rb
vedeu-0.4.24 lib/vedeu/repositories/all.rb
vedeu-0.4.23 lib/vedeu/repositories/all.rb
vedeu-0.4.22 lib/vedeu/repositories/all.rb
vedeu-0.4.21 lib/vedeu/repositories/all.rb
vedeu-0.4.20 lib/vedeu/repositories/all.rb
vedeu-0.4.19 lib/vedeu/repositories/all.rb