class Formtastic::Deprecation

@private @todo remove this branch and file when support for rails 3.2 is dropped

Public Class Methods

new(version, _library) click to toggle source
# File lib/formtastic/deprecation.rb, line 19
def initialize(version, _library)
  deprecation.silenced = false
  deprecation.deprecation_horizon = version
end

Public Instance Methods

deprecated_method_warning(method_name, message = nil) click to toggle source
# File lib/formtastic/deprecation.rb, line 32
def deprecated_method_warning(method_name, message = nil)
  warning = "#{method_name} is deprecated and will be removed from Formtastic #{deprecation_horizon}"
  case message
    when Symbol then "#{warning} (use #{message} instead)"
    when String then "#{warning} (#{message})"
    else warning
  end
end
deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil) click to toggle source
# File lib/formtastic/deprecation.rb, line 24
def deprecation_warning(deprecated_method_name, message = nil, caller_backtrace = nil)
  caller_backtrace ||= caller(2)

  deprecated_method_warning(deprecated_method_name, message).tap do |msg|
    warn(msg, caller_backtrace)
  end
end