Class/Module Index [+]

Quicksearch

Backup::Configuration::Helpers::ClassMethods

Public Instance Methods

clear_defaults!() click to toggle source

Used only within the specs

# File lib/backup/configuration/helpers.rb, line 29
def clear_defaults!
  defaults.reset!
end
defaults() click to toggle source

Returns or yields the Configuration::Store for storing pre-configured defaults for the class.

# File lib/backup/configuration/helpers.rb, line 17
def defaults
  @configuration ||= Configuration::Store.new

  if block_given?
    yield @configuration
  else
    @configuration
  end
end
deprecations() click to toggle source
# File lib/backup/configuration/helpers.rb, line 33
def deprecations
  @deprecations ||= {}
end
log_deprecation_warning(name, deprecation) click to toggle source
# File lib/backup/configuration/helpers.rb, line 37
def log_deprecation_warning(name, deprecation)
  msg = "#{ self }##{ name } has been deprecated as of " +
      "backup v.#{ deprecation[:version] }"
  msg << "\n#{ deprecation[:message] }" if deprecation[:message]
  Logger.warn Error.new(            [DEPRECATION WARNING]            #{ msg })
end

Protected Instance Methods

attr_deprecate(name, args = {}) click to toggle source

Method to deprecate an attribute.

:version

Must be set to the backup version which will first
introduce the deprecation.

:action

If set, this Proc will be called with a reference to the
class instance and the value set on the deprecated accessor.
e.g. deprecation[:action].call(klass, value)
This should perform whatever action is neccessary, such as
transferring the value to a new accessor.

:message

If set, this will be appended to #log_deprecation_warning

Note that this replaces the `attr_accessor` method, or other method previously used to set the accessor being deprecated. method_missing will handle any calls to `name=`.

# File lib/backup/configuration/helpers.rb, line 70
def attr_deprecate(name, args = {})
  deprecations[name] = {
    :version => nil,
    :message => nil,
    :action => nil
  }.merge(args)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.