Sha256: 3d66896aa6d291a850f06f9cc59f4b673e402878e224109d7bcdeade00e313bd

Contents?: true

Size: 792 Bytes

Versions: 4

Compression:

Stored size: 792 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 # Repositories

end # Vedeu

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vedeu-0.4.52 lib/vedeu/repositories/all.rb
vedeu-0.4.51 lib/vedeu/repositories/all.rb
vedeu-0.4.50 lib/vedeu/repositories/all.rb
vedeu-0.4.49 lib/vedeu/repositories/all.rb