nub 0.0.35 → 0.0.36

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. checksums.yaml +4 -4
  2. data/lib/nub/log.rb +13 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14efb7fa976af799cce7a81dc1c380a9693fc9e7662d79c4db611011b44dbf9f
4
- data.tar.gz: 718d3542289f23b057c6278e9c9f17e0ab6a16184cbabada6f44136c2e4dd915
3
+ metadata.gz: 20dfa82087dac3fc6f2aca133219ffff8f13614017c6a0ce78c07b28ab63ccb1
4
+ data.tar.gz: 4874238d59fab76c44734625345372ab8d18e465fb1c9d4c04399e57f2a3b936
5
5
  SHA512:
6
- metadata.gz: 805fd25ade06515accbf5d82616200d21e2c84447512a761bbfb8aeb85634440ce5c8e79cae9b15bfcfc72eb871716a2dc69d2aa8ff953c762749f7b4d099876
7
- data.tar.gz: df51f2ac8b2c5d129a75dbe796d27c887f89471b1c0b8b7a315e2f86eedd8c88bc170e8050611e5adbb44db27b05e3de5b144df591b14c0cde53a7cfd668f5b1
6
+ metadata.gz: 02fc00dd683da7166068c94209cd154db09747c9adde25e5f397de7aefda175864cd3b35bbe3003cd3c75d4b3c3159fe6d1ff518feb577258cfbee3586c3f2f9
7
+ data.tar.gz: 4dfcd93cacdd01224bad1872523f9e9d8473e07eac6d645fd70c56d00e8c98fd5b5b22301ff57c529de8b14c66e2e1974685f693c3edf6ef4a807f380b82a35f
data/lib/nub/log.rb CHANGED
@@ -73,7 +73,8 @@ module Log
73
73
  @@_monitor.synchronize{
74
74
 
75
75
  # Skip first 3 on stack (i.e. 0 = block in format, 1 = synchronize, 2 = format)
76
- stack = caller_locations(3, 20)
76
+ stack = caller_locations(3, 10)
77
+ #stack.each{|x| $stdout.puts(x.label)}
77
78
 
78
79
  # Skip past any calls in 'log.rb' or 'monitor.rb'
79
80
  i = -1
@@ -85,14 +86,21 @@ module Log
85
86
  # Save lineno from original location
86
87
  lineno = stack[i].lineno
87
88
 
88
- # Skip over block type functions to use method
89
- nested = ['rescue in', 'block in', 'each']
90
- while nested.any?{|x| stack[i].label.include?(x)} do
89
+ # Skip over block type functions to use method.
90
+ # Note: there may not be a non block method e.g. in thread case
91
+ regexps = [Regexp.new('^rescue\s.*in\s'), Regexp.new('^block\s.*in\s'), Regexp.new('^each$')]
92
+ while regexps.any?{|regexp| stack[i].label =~ regexp} do
93
+ break if i + 1 == stack.size
91
94
  i += 1
92
95
  end
93
96
 
97
+ # Set label, clean up for block case
98
+ label = stack[i].label
99
+ regexps.each{|x| label = label.gsub(label[x], "") if stack[i].label =~ x}
100
+ label = stack[i].label if label.empty?
101
+
94
102
  # Construct stamp
95
- loc = ":#{File.basename(stack[i].path, '.rb')}:#{stack[i].label}:#{lineno}"
103
+ loc = ":#{File.basename(stack[i].path, '.rb')}:#{label}:#{lineno}"
96
104
  return "#{Time.now.utc.iso8601(3)}#{loc}:: #{str}"
97
105
  }
98
106
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nub
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.35
4
+ version: 0.0.36
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Crummett