class Configurator::DeprecatedOption

Public Class Methods

new(name, parent, object, end_of_life = nil) click to toggle source
Calls superclass method Configurator::DelegatedOption::new
# File lib/configurator/delegated.rb, line 95
def initialize(name, parent, object, end_of_life = nil)
  @eol = end_of_life
  super(name, parent, object)
end

Public Instance Methods

emit_warning() click to toggle source
# File lib/configurator/delegated.rb, line 100
def emit_warning
  if @eol && !@eol.is_a?(TrueClass)
    @eol = case @eol
      when Date, DateTime, Time then @eol.strftime('%F')
      else @eol
    end
    warn "Configuration option #{path_name} is deprecated and will no longer be available on or after #{@eol}."
  else
    warn "Configuration option #{path_name} is deprecated and will be removed soon."
  end
end