Sha256: 87515aaf7abf1e65bd0963f19c5a6102811a00acd177e0630a5a96f40a8db560
Contents?: true
Size: 1.28 KB
Versions: 6
Compression:
Stored size: 1.28 KB
Contents
require 'active_support/deprecation' module Formtastic if ActiveSupport::Deprecation.respond_to?(:new) Deprecation = ActiveSupport::Deprecation else require 'forwardable' # @private # @todo remove this branch and file when support for rails 3.2 is dropped class Deprecation mattr_accessor :deprecation self.deprecation = ActiveSupport::Deprecation.dup extend Forwardable methods = deprecation.methods - deprecation.class.methods def_delegators :deprecation, *methods def initialize(version, _library) deprecation.silenced = false deprecation.deprecation_horizon = version end 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 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 end end end
Version data entries
6 entries across 6 versions & 2 rubygems