Sha256: 5ab7345f228d12c25cda8aced0a21be3c25082c1e0e805d0f5c6cf892d3f9a98

Contents?: true

Size: 929 Bytes

Versions: 3

Compression:

Stored size: 929 Bytes

Contents

module Mongoid
  module Archivable
    module Depot
      extend ActiveSupport::Concern
      included do
        include ClassMethods
      end

      module ClassMethods
        def has_archive_storage?
          !parent.archive_storage.nil?
        end

        def has_archive_client?
          has_archive_storage? && !parent.archive_storage[:client].nil?
        end

        def has_archive_database?
          has_archive_storage? && !parent.archive_storage[:client].nil?
        end

        def archive_database_name
          if has_archive_database?
            parent.archive_storage[:database]
          else
            Mongoid::Archivable.config.get_database
          end
        end

        def archive_client_name
          if has_archive_client?
            parent.archive_storage[:client]
          else
            Mongoid::Archivable.config.get_client
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mongoid-archivable-1.7.1 lib/mongoid/archivable/depot.rb
mongoid-archivable-1.7.0 lib/mongoid/archivable/depot.rb
mongoid-archivable-1.6.0 lib/mongoid/archivable/depot.rb