module ExceptionNotification::NotifierHelper
Constants
- APP_PATH
- PARAM_FILTER_REPLACEMENT
- VIEW_PATH
Public Instance Methods
exclude_raw_post_parameters?()
click to toggle source
# File lib/exception_notification/notifier_helper.rb, line 46 def exclude_raw_post_parameters? @controller && @controller.respond_to?(:filter_parameters) end
filter_sensitive_post_data_from_env(env_key, env_value)
click to toggle source
# File lib/exception_notification/notifier_helper.rb, line 54 def filter_sensitive_post_data_from_env(env_key, env_value) return env_value unless exclude_raw_post_parameters? return PARAM_FILTER_REPLACEMENT if (env_key =~ /RAW_POST_DATA/i) return @controller.__send__(:filter_parameters, {env_key => env_value}).values[0] end
filter_sensitive_post_data_parameters(parameters)
click to toggle source
# File lib/exception_notification/notifier_helper.rb, line 50 def filter_sensitive_post_data_parameters(parameters) exclude_raw_post_parameters? ? @controller.__send__(:filter_parameters, parameters) : parameters end
inspect_model_object(model, locals={})
click to toggle source
# File lib/exception_notification/notifier_helper.rb, line 28 def inspect_model_object(model, locals={}) render_overridable(:inspect_model, :locals => { :inspect_model => model, :show_instance_variables => true, :show_attributes => true }.merge(locals)) end
inspect_value(value)
click to toggle source
# File lib/exception_notification/notifier_helper.rb, line 35 def inspect_value(value) len = 512 result = object_to_yaml(value).gsub(/\n/, "\n ").strip result = result[0,len] + "... (#{result.length-len} bytes more)" if result.length > len+20 result end
object_to_yaml(object)
click to toggle source
# File lib/exception_notification/notifier_helper.rb, line 42 def object_to_yaml(object) object.to_yaml.sub(/^---\s*/m, "") end
render_overridable(partial, options={})
click to toggle source
# File lib/exception_notification/notifier_helper.rb, line 17 def render_overridable(partial, options={}) if File.exist?(path = "#{APP_PATH}/_#{partial}.html.erb") || File.exist?(path = "#{File.dirname(__FILE__)}/../#{VIEW_PATH}/_#{partial}.html.erb") || File.exist?(path = "#{APP_PATH}/_#{partial}.rhtml") || File.exist?(path = "#{APP_PATH}/_#{partial}.erb") render(options.merge(:file => path, :use_full_path => false)) else "" end end
render_section(section)
click to toggle source
# File lib/exception_notification/notifier_helper.rb, line 8 def render_section(section) RAILS_DEFAULT_LOGGER.info("rendering section #{section.inspect}") summary = render_overridable(section).strip unless summary.blank? title = render_overridable(:title, :locals => { :title => section }).strip "#{title}\n\n#{summary.gsub(/^/, " ")}\n\n" end end