betterlog 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/betterlog.gemspec +2 -2
- data/lib/betterlog/global_metadata.rb +6 -2
- data/lib/betterlog/version.rb +1 -1
- data/spec/betterlog/global_metadata_spec.rb +14 -4
- data/spec/betterlog/log_spec.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a14afeaf9f071dd35f0ba6fa5ae5a7052e71ea80e6872ef1f00245afcea15164
|
4
|
+
data.tar.gz: 1da4a6ab2c4ca3e79bf466dfe06a0d1ac786c8660f89b5dcda47ec5c9052b34d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 234235247f8b69eb8d67f9b4c9d24dc6e632ae567b1f4708f52a2d05fe3b4af11f9a726798af60f5c01615816c1cf1420a47dfbd6607f7a20a84f1b250e65429
|
7
|
+
data.tar.gz: 0bb91c78f26c795c108a462fbe4e1fbf305fa335eddfa92ebc270f587263dd952e6728d4bf615de73bf0a2144f0b07b627481d4d27fff1dc6206080db03ec8d0
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.1
|
data/betterlog.gemspec
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
# stub: betterlog 2.0.
|
2
|
+
# stub: betterlog 2.0.1 ruby lib
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = "betterlog".freeze
|
6
|
-
s.version = "2.0.
|
6
|
+
s.version = "2.0.1"
|
7
7
|
|
8
8
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
9
9
|
s.require_paths = ["lib".freeze]
|
@@ -20,11 +20,15 @@ module Betterlog
|
|
20
20
|
keys.each { current.delete(_1) }
|
21
21
|
end
|
22
22
|
|
23
|
-
def
|
23
|
+
def with_meta(data = {}, &block)
|
24
24
|
add data
|
25
|
-
|
25
|
+
block.call(current.dup.freeze)
|
26
26
|
ensure
|
27
27
|
remove data
|
28
28
|
end
|
29
29
|
end
|
30
|
+
|
31
|
+
def self.with_meta(data = {}, &block)
|
32
|
+
Betterlog::GlobalMetadata.with_meta(data, &block)
|
33
|
+
end
|
30
34
|
end
|
data/lib/betterlog/version.rb
CHANGED
@@ -33,10 +33,10 @@ describe Betterlog::GlobalMetadata do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
describe '.
|
36
|
+
describe '.with_meta' do
|
37
37
|
it 'can add to context and remove it' do
|
38
38
|
expect(Betterlog::GlobalMetadata.current).to be_empty
|
39
|
-
Betterlog::GlobalMetadata.
|
39
|
+
Betterlog::GlobalMetadata.with_meta(
|
40
40
|
'foo' => 'bar',
|
41
41
|
:bar => 'foo',
|
42
42
|
) do |my_context|
|
@@ -49,14 +49,14 @@ describe Betterlog::GlobalMetadata do
|
|
49
49
|
|
50
50
|
it 'can add to nested context and remove it' do
|
51
51
|
expect(Betterlog::GlobalMetadata.current).to be_empty
|
52
|
-
Betterlog::GlobalMetadata.
|
52
|
+
Betterlog::GlobalMetadata.with_meta(
|
53
53
|
'foo' => 'bar',
|
54
54
|
:bar => 'foo',
|
55
55
|
) do |my_context|
|
56
56
|
expect(Betterlog::GlobalMetadata.current).to eq(foo: 'bar', bar: 'foo')
|
57
57
|
expect(my_context).to eq(foo: 'bar', bar: 'foo')
|
58
58
|
expect(my_context).to be_frozen
|
59
|
-
Betterlog::GlobalMetadata.
|
59
|
+
Betterlog::GlobalMetadata.with_meta('quux' => 'quark') do |my_context|
|
60
60
|
expect(my_context).to be_frozen
|
61
61
|
expect(Betterlog::GlobalMetadata.current).to eq(foo: 'bar', bar: 'foo', quux: 'quark')
|
62
62
|
expect(my_context).to eq(foo: 'bar', bar: 'foo', quux: 'quark')
|
@@ -65,6 +65,16 @@ describe Betterlog::GlobalMetadata do
|
|
65
65
|
end
|
66
66
|
expect(Betterlog::GlobalMetadata.current).to be_empty
|
67
67
|
end
|
68
|
+
|
69
|
+
it 'has shortcut method Betterlog.with_meta' do
|
70
|
+
expect(Betterlog::GlobalMetadata.current).to be_empty
|
71
|
+
Betterlog.with_meta(
|
72
|
+
'foo' => 'bar',
|
73
|
+
:bar => 'foo',
|
74
|
+
) do
|
75
|
+
expect(Betterlog::GlobalMetadata.current).to eq(foo: 'bar', bar: 'foo')
|
76
|
+
end
|
77
|
+
end
|
68
78
|
end
|
69
79
|
|
70
80
|
class FakeNotifierClass
|
data/spec/betterlog/log_spec.rb
CHANGED