Default warning behaviors per Rails.env.
# File lib/active_support/deprecation/behaviors.rb, line 10 def behavior @behavior ||= [DEFAULT_BEHAVIORS[:stderr]] end
# File lib/active_support/deprecation/behaviors.rb, line 14 def behavior=(behavior) @behavior = Array.wrap(behavior).map { |b| DEFAULT_BEHAVIORS[b] || b } end
Declare that a method has been deprecated.
# File lib/active_support/deprecation/method_wrappers.rb, line 8 def deprecate_methods(target_module, *method_names) options = method_names.extract_options! method_names += options.keys method_names.each do |method_name| target_module.alias_method_chain(method_name, :deprecation) do |target, punctuation| target_module.module_eval( def #{target}_with_deprecation#{punctuation}(*args, &block) ::ActiveSupport::Deprecation.warn( ::ActiveSupport::Deprecation.deprecated_method_warning( :#{method_name}, #{options[method_name].inspect}), caller ) send(:#{target}_without_deprecation#{punctuation}, *args, &block) end, __FILE__, __LINE__ + 1) end end end
# File lib/active_support/deprecation/reporting.rb, line 21 def deprecated_method_warning(method_name, message = nil) warning = "#{method_name} is deprecated and will be removed from Rails #{deprecation_horizon}" case message when Symbol then "#{warning} (use #{message} instead)" when String then "#{warning} (#{message})" else warning end end
Generated with the Darkfish Rdoc Generator 2.