Sha256: 698a61a89fe9bfb733c36c9b25fa6d4dd2a35c4a0db347f1ed738e83f33721c8

Contents?: true

Size: 813 Bytes

Versions: 7

Compression:

Stored size: 813 Bytes

Contents

# encoding: utf-8

%w[helpers store].each do |file|
  require File.expand_path("../configuration/#{file}", __FILE__)
end

# Temporary measure for deprecating the use of Configuration
# namespaced classes for setting pre-configured defaults.
module Backup
  module Configuration
    extend self

    ##
    # Pass calls on to the proper class and log a warning
    def defaults(&block)
      klass = eval(self.to_s.sub('Configuration::', ''))
      Logger.warn Error.new(<<-EOS)
        [DEPRECATION WARNING]
        #{ self }.defaults is being deprecated.
        To set pre-configured defaults for #{ klass }, use:
        #{ klass }.defaults
      EOS
      klass.defaults(&block)
    end

    private

    def const_missing(const)
      const_set(const, Module.new { extend Configuration })
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
backup-3.11.0 lib/backup/configuration.rb
backup-3.10.0 lib/backup/configuration.rb
backup-3.9.0 lib/backup/configuration.rb
backup-3.8.0 lib/backup/configuration.rb
backup-3.7.2 lib/backup/configuration.rb
backup-3.7.1 lib/backup/configuration.rb
backup-3.7.0 lib/backup/configuration.rb