Class: RescueEach::Error::Item
- Inherits:
-
Struct
- Object
- Struct
- RescueEach::Error::Item
- Defined in:
- lib/rescue_each.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#exception ⇒ Object
Returns the value of attribute exception.
Instance Method Summary collapse
- #args_full ⇒ Object
- #args_short ⇒ Object
- #backtrace_lines ⇒ Object
- #backtrace_s ⇒ Object
- #message ⇒ Object
- #short_message ⇒ Object
- #title ⇒ Object
- #to_s ⇒ Object
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args
15 16 17 |
# File 'lib/rescue_each.rb', line 15 def args @args end |
#exception ⇒ Object
Returns the value of attribute exception
15 16 17 |
# File 'lib/rescue_each.rb', line 15 def exception @exception end |
Instance Method Details
#args_full ⇒ Object
34 35 36 |
# File 'lib/rescue_each.rb', line 34 def args_full "args: #{args.inspect}" end |
#args_short ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rescue_each.rb', line 21 def args_short args_str = args.map do |arg| str = arg.inspect max_length = 500 if str.size > max_length str.slice(0, max_length) + " [#{str.size-max_length} more chars...]" else str end end "args: " + args_str.join(", ") end |
#backtrace_lines ⇒ Object
38 39 40 |
# File 'lib/rescue_each.rb', line 38 def backtrace_lines exception.backtrace.take_while { |line| !line.index(__FILE__) } end |
#backtrace_s ⇒ Object
42 43 44 |
# File 'lib/rescue_each.rb', line 42 def backtrace_s "\t#{backtrace_lines.join "\n\t"}" end |
#message ⇒ Object
50 51 52 |
# File 'lib/rescue_each.rb', line 50 def "#{title}\n#{args_full}\n#{backtrace_s}" end |
#short_message ⇒ Object
46 47 48 |
# File 'lib/rescue_each.rb', line 46 def "#{title} (#{args_short})" end |
#title ⇒ Object
17 18 19 |
# File 'lib/rescue_each.rb', line 17 def title "#{exception.} (#{exception.class})" end |
#to_s ⇒ Object
54 55 56 |
# File 'lib/rescue_each.rb', line 54 def to_s "\n#{}" end |