formatted-metrics 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: 7a49f0faab052704e66f51de8caa1d7b87ee38e7
4
+ data.tar.gz: a5d70350b860e82bc2f6bbafd3f9401bb9fe4506
5
+ !binary "U0hBNTEy":
6
+ metadata.gz: b5c760f13ca2e109992cab773bec7547a8c89e5ae751216e8c1778e841715531e9e7439eeaf804144c11c076071795595a1895d432ac6494c1d4773d6e7119c2
7
+ data.tar.gz: 9662661ebb0ec099da74950c0cd8aafb6ae77a77cac7c99ff7ec8ba9123f15b5f6882da6982ead3c846da4f114b3c6f08b133a33e298f690ec855c31211ba533
@@ -48,7 +48,8 @@ module Metrics
48
48
 
49
49
  def result
50
50
  return nil unless block
51
- @result ||= block.call
51
+ return @result if defined?(@result)
52
+ @result = block.call
52
53
  end
53
54
 
54
55
  private
@@ -1,3 +1,3 @@
1
1
  module FormattedMetrics
2
- VERSION = '1.0.2'
2
+ VERSION = '1.0.3'
3
3
  end
@@ -50,6 +50,17 @@ describe Metrics::Instrumenter do
50
50
  it { should eq 'foo' }
51
51
  end
52
52
 
53
+ context 'with a block returning nil' do
54
+ let(:block) { Proc.new { nil } }
55
+ let(:instrumenter) { described_class.new('rack.request', &block) }
56
+
57
+ it 'should still memoize the result of the block' do
58
+ block.should_receive(:call).once
59
+ instrumenter.result
60
+ instrumenter.result
61
+ end
62
+ end
63
+
53
64
  context 'with a value' do
54
65
  let(:instrumenter) { described_class.new('jobs.busy', 10, units: 'jobs') }
55
66
  it { should be_nil }
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: formatted-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
5
- prerelease:
4
+ version: 1.0.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Eric J. Holmes
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-18 00:00:00.000000000 Z
11
+ date: 2013-09-25 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: bundler
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rake
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ! '>='
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ! '>='
44
39
  - !ruby/object:Gem::Version
@@ -46,7 +41,6 @@ dependencies:
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: rspec
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
@@ -54,7 +48,6 @@ dependencies:
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
@@ -96,33 +89,26 @@ files:
96
89
  homepage: http://github.com/remind101/formatted-metrics
97
90
  licenses:
98
91
  - MIT
92
+ metadata: {}
99
93
  post_install_message:
100
94
  rdoc_options: []
101
95
  require_paths:
102
96
  - lib
103
97
  required_ruby_version: !ruby/object:Gem::Requirement
104
- none: false
105
98
  requirements:
106
99
  - - ! '>='
107
100
  - !ruby/object:Gem::Version
108
101
  version: '0'
109
- segments:
110
- - 0
111
- hash: -3587489995332029312
112
102
  required_rubygems_version: !ruby/object:Gem::Requirement
113
- none: false
114
103
  requirements:
115
104
  - - ! '>='
116
105
  - !ruby/object:Gem::Version
117
106
  version: '0'
118
- segments:
119
- - 0
120
- hash: -3587489995332029312
121
107
  requirements: []
122
108
  rubyforge_project:
123
- rubygems_version: 1.8.23
109
+ rubygems_version: 2.0.3
124
110
  signing_key:
125
- specification_version: 3
111
+ specification_version: 4
126
112
  summary: Easily output formatted metrics to stdout
127
113
  test_files:
128
114
  - spec/metrics/formatters/l2met_spec.rb