logspot 0.6.1 → 0.6.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f5ae54d5dd3569ef38ee4c3b13bb6614fa2476db
4
- data.tar.gz: 978db92b679c41b9bb98f81b71b2169635f64dcd
3
+ metadata.gz: 0373a708827acf8aee24e2bd09c43ebdb146aa0e
4
+ data.tar.gz: 5388889e9017ea2e3ced123835daddad20ba7ccb
5
5
  SHA512:
6
- metadata.gz: f04b4fa5ac23f42d04fdef658053ac832e94f156841a95e9b3b55f42bb437ebd04d0cea409cad940a30c47bedc10d147a1c1398040801b3b91fdbff2c5c62ec0
7
- data.tar.gz: 4db43c70580e0b8344527d1e449c444e502a50c45e4f850bdafae300614ef60d301a86539e4d36c6a4fe5ac52e4085c847e6bc3cf80a7b58ad7787f5a799cca9
6
+ metadata.gz: bd38e97b570b0b1feabf617806be2a47a1282882d2d4be53a02dbf0dccf0386ce6d4a728ee89b5764b98fb6c7f47301ab1d2fa8d2ec60ef4b88e5e3aaa2a863d
7
+ data.tar.gz: d14c08df7a755d438ca6c59a2d5e0f040b0161c0cb0997f9419fef2bf3665f0589d51e1b5211860a4a5b1fd8196645ed0ec01f8c5f25f8e136707641538a0800
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- logspot (0.6.1)
4
+ logspot (0.6.2)
5
5
  activesupport (>= 4)
6
6
 
7
7
  GEM
@@ -7,7 +7,7 @@ class LoGspot
7
7
  wrapper = ->(output, data) {
8
8
  base = tag_block ? tag_block.(Time.current, level) : tag_format % { time: Time.current.strftime(time_format), level: level }
9
9
  if data[:space]
10
- base = ' ' * base.length
10
+ base = ' ' * uncolorize_str(base).length
11
11
  end
12
12
  output.puts(message: "#{base}#{data[:message]}")
13
13
  }
@@ -19,8 +19,8 @@ class LoGspot
19
19
  def tagged(tag, &block)
20
20
  wrap_output(block) do |output, data|
21
21
  base = tag
22
- if space = !!data[:space]
23
- base = ' ' * base.length
22
+ if space = data[:space]
23
+ base = ' ' * uncolorize_str(base).length
24
24
  end
25
25
  output.puts(data.merge(message: "#{base}#{data[:message]}", space: space))
26
26
  end
@@ -32,7 +32,7 @@ class LoGspot
32
32
  message = data[:message]
33
33
  base = tag
34
34
  if data[:space] || !first
35
- base = ' ' * base.length
35
+ base = ' ' * uncolorize_str(base).length
36
36
  end
37
37
  if first
38
38
  output.puts(data.merge(message: "#{base}#{message}", space: false))
@@ -116,4 +116,8 @@ class LoGspot
116
116
  @output = previous_output
117
117
  res
118
118
  end
119
+
120
+ def uncolorize_str(str)
121
+ str.gsub(/\033\[[;0-9]+m/, '')
122
+ end
119
123
  end
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logspot'
3
- s.version = '0.6.1'
3
+ s.version = '0.6.2'
4
4
  s.authors = ['Tetsuri Moriya']
5
5
  s.email = ['tetsuri.moriya@gmail.com']
6
6
  s.summary = 'Logger'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logspot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tetsuri Moriya