class SitePrism::Deprecator

SitePrism::Deprecator

Public Class Methods

deprecate(old, new = nil) click to toggle source

@return SitePrism.logger.warn(msg)

Tells the user that they are using old functionality, which needs removing in the next major version

# File lib/site_prism/deprecator.rb, line 11
def deprecate(old, new = nil)
  if new
    warn("#{old} is being deprecated and should no longer be used. Use #{new} instead.")
  else
    warn("#{old} is being deprecated and should no longer be used.")
  end

  warn("#{old} will be removed in SitePrism v4. You have been warned!")
end
soft_deprecate(old, reason, new = nil) click to toggle source

@return SitePrism.logger.debug(msg)

Tells the user that they are using functionality which is non-optimal

The functionality should usually provide a reason for it being poor, as well as an
optional way of upgrading to something different

NB: As this is bubbled up at debug level, often users will not see this. So it will never be a candidate for removal directly

# File lib/site_prism/deprecator.rb, line 29
def soft_deprecate(old, reason, new = nil)
  debug("The #{old} method is changing, as is SitePrism, and is now configurable.")
  debug("REASON: #{reason}.")
  debug('Moving forwards into SitePrism v4, the default behaviour will change.')
  debug("We advise you change to using #{new}") if new
end

Private Class Methods

debug(msg) click to toggle source
# File lib/site_prism/deprecator.rb, line 42
def debug(msg)
  SitePrism.logger.debug(msg)
end
warn(msg) click to toggle source
# File lib/site_prism/deprecator.rb, line 38
def warn(msg)
  SitePrism.logger.warn(msg)
end