advisor 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e483f74eff0de6b04eed5051b4d289b44dfb7a80
4
- data.tar.gz: 8a852c9df0b89d7afaaf16ee53c407cfa13b8a52
3
+ metadata.gz: bd0bff4c56325afe9169e9a9e6846f39a5b5050d
4
+ data.tar.gz: 7ed6cd9a3a9e940ae3c62b216da94c333b7910be
5
5
  SHA512:
6
- metadata.gz: 144f536d6c89850f100ff1025802f1be321868d9721a4849756b309a2e60a41aee9b4b63447a818a5d4e7d0cb884240676ba6c0161a107611dc2134be7d4dc13
7
- data.tar.gz: fa95e30ccb7eb56b3138420203334d094e8dc9b5db7fbe134f9ea3b2e8147542e8d42673e1b42ff7d03985229c9b0c01d6de0f6a299f56a849b3ab7ae6585d2d
6
+ metadata.gz: d2d760a6c6ee40363b916cb8233b488a0bfae01a021836695a6801e736751fcfd34106b93f49afdcc5f1dfc8e06fcb2402372a15f0182cb3b5e397c44a2e92dd
7
+ data.tar.gz: 1d33b22f3299bc1176a536771bcdcec3f756c4b389cc7bbdba6513c8519daeab17fb28758de33c861d9816b69305251d376cedb5ca91a210ada34e99e55b2e86
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- advisor (0.2.0)
4
+ advisor (0.2.1)
5
5
  metriks
6
6
 
7
7
  GEM
@@ -13,7 +13,13 @@ GEM
13
13
  atomic (1.1.99)
14
14
  avl_tree (1.2.1)
15
15
  atomic (~> 1.1)
16
+ byebug (3.5.1)
17
+ columnize (~> 0.8)
18
+ debugger-linecache (~> 1.2)
19
+ slop (~> 3.6)
16
20
  coderay (1.1.0)
21
+ columnize (0.9.0)
22
+ debugger-linecache (1.2.0)
17
23
  diff-lcs (1.2.5)
18
24
  hitimes (1.2.2)
19
25
  method_source (0.8.2)
@@ -28,6 +34,9 @@ GEM
28
34
  coderay (~> 1.1.0)
29
35
  method_source (~> 0.8.1)
30
36
  slop (~> 3.4)
37
+ pry-byebug (3.0.0)
38
+ byebug (~> 3.4)
39
+ pry (~> 0.10)
31
40
  rainbow (2.0.0)
32
41
  rake (10.4.2)
33
42
  rspec (3.2.0)
@@ -59,6 +68,7 @@ DEPENDENCIES
59
68
  advisor!
60
69
  bundler (~> 1.7)
61
70
  pry
71
+ pry-byebug
62
72
  rake (~> 10.0)
63
73
  rspec (~> 3.0)
64
74
  rubocop
data/advisor.gemspec CHANGED
@@ -25,4 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'rake', '~> 10.0'
26
26
  spec.add_development_dependency 'rubocop'
27
27
  spec.add_development_dependency 'pry'
28
+ spec.add_development_dependency 'pry-byebug'
28
29
  end
@@ -31,8 +31,8 @@ module Advisor
31
31
  end
32
32
 
33
33
  def call
34
- (timed? ? timed_call { yield } : yield)
35
- .tap { |result| instruments.each(&measure(result)) }
34
+ result = timed? ? timer.time { yield } : yield
35
+ result.tap { instruments.each(&measure(result)) }
36
36
  rescue => e
37
37
  logger.warn(e)
38
38
  raise
@@ -40,13 +40,6 @@ module Advisor
40
40
 
41
41
  private
42
42
 
43
- def timed_call
44
- timer.time
45
- yield.tap do
46
- timer.stop
47
- end
48
- end
49
-
50
43
  def measure(result)
51
44
  # How I wish I had currying...
52
45
  lambda do |instrument|
@@ -1,3 +1,3 @@
1
1
  module Advisor
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
@@ -138,14 +138,11 @@ module Advisor
138
138
  context 'when using a timer' do
139
139
  let(:instruments) { %i(counter result_meter call_meter gauge timer) }
140
140
 
141
- let(:timer) { instance_double(::Metriks::Timer) }
141
+ let(:timer) { ::Metriks.timer('a-timer') }
142
142
 
143
143
  before do
144
144
  allow(::Metriks).to receive(:timer)
145
145
  .and_return(timer)
146
-
147
- allow(timer).to receive(:time)
148
- allow(timer).to receive(:stop)
149
146
  end
150
147
 
151
148
  it_behaves_like 'instruments && measuring'
@@ -153,13 +150,14 @@ module Advisor
153
150
  it 'finds the right timer metric' do
154
151
  expect(::Metriks).to receive(:timer)
155
152
  .with('OpenStruct#the_force_awakens_timer')
153
+ .and_call_original
156
154
 
157
155
  call
158
156
  end
159
157
 
160
158
  it 'times the method call' do
161
159
  expect(timer).to receive(:time)
162
- expect(timer).to receive(:stop)
160
+ .and_call_original
163
161
 
164
162
  call
165
163
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: advisor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Renan Ranelli
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-01 00:00:00.000000000 Z
11
+ date: 2015-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: metriks
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-byebug
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description:
98
112
  email:
99
113
  - renanranelli@gmail.com
@@ -148,3 +162,4 @@ signing_key:
148
162
  specification_version: 4
149
163
  summary: AOP with anonymous modules
150
164
  test_files: []
165
+ has_rdoc: