Class: GlobalErrorHandler::Parser
- Inherits:
-
Object
- Object
- GlobalErrorHandler::Parser
- Defined in:
- lib/global_error_handler/parser.rb
Instance Attribute Summary collapse
-
#info_hash ⇒ Object
readonly
Returns the value of attribute info_hash.
Instance Method Summary collapse
-
#initialize(env, exception, controller) ⇒ Parser
constructor
A new instance of Parser.
- #parse ⇒ Object
Constructor Details
#initialize(env, exception, controller) ⇒ Parser
Returns a new instance of Parser.
4 5 6 7 8 9 10 |
# File 'lib/global_error_handler/parser.rb', line 4 def initialize(env, exception, controller) @env = env @exception = exception @controller = controller @request = ActionDispatch::Request.new(@env) @info_hash = {} end |
Instance Attribute Details
#info_hash ⇒ Object (readonly)
Returns the value of attribute info_hash.
2 3 4 |
# File 'lib/global_error_handler/parser.rb', line 2 def info_hash @info_hash end |
Instance Method Details
#parse ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/global_error_handler/parser.rb', line 12 def parse @info_hash[:error_class] = @exception.class.to_s.strip @info_hash[:error_message] = @exception..to_s.strip @info_hash[:error_trace] = @exception.backtrace.join("\n") @info_hash[:request_method] = @request.method @info_hash[:request_params] = @request.params @info_hash[:target_url] = @request.url @info_hash[:referer_url] = @request.referer @info_hash[:user_agent] = @request.user_agent @info_hash[:user_info] = user_info @info_hash[:timestamp] = Time.now.utc self end |