mole 1.0.7 → 1.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/mole/moler.rb +11 -3
  2. data/lib/mole/version.rb +1 -1
  3. metadata +1 -1
data/lib/mole/moler.rb CHANGED
@@ -16,7 +16,7 @@ module Mole
16
16
  # If exception is given record the first couple of frames
17
17
  if args[:boom]
18
18
  args[:trace] = dump_stack( args[:boom] )
19
- args[:boom] = args[:boom].to_s
19
+ args[:boom] = truncate( args[:boom].to_s )
20
20
  end
21
21
  if ::Mole.persistent?
22
22
  MoleLog.log_it( context, MoleFeature::find_exception_feature( ::Mole.application ), user_id, args )
@@ -54,10 +54,18 @@ module Mole
54
54
  end
55
55
  end
56
56
 
57
+ # Truncate
58
+ def truncate(text, length = 200, truncate_string = "...")
59
+ return "" if text.nil?
60
+ l = length - truncate_string.chars.length
61
+ text.chars.length > length ? (text.chars[0...l] + truncate_string).to_s : text
62
+ end
63
+
57
64
  # dumps partial stack
58
- def dump_stack( boom )
65
+ def dump_stack( boom )
66
+ return truncate( boom.backtrace[0] ) if boom.backtrace.size == 1
59
67
  buff = boom.backtrace[0...3].join( "-" )
60
- end
68
+ end
61
69
  end
62
70
  end
63
71
  end
data/lib/mole/version.rb CHANGED
@@ -2,7 +2,7 @@ module Mole
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 0
5
- TINY = 7
5
+ TINY = 8
6
6
 
7
7
  # Returns the version string for the library.
8
8
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mole
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernand Galiana