micro_bench 0.1.2 → 0.1.3

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: a8c91db76af4392989e7cef3b27ab9bd4b421c77
4
- data.tar.gz: 609656197b6121fab78832159497579b63c0b877
3
+ metadata.gz: 5eeb98130357a3e9320237286d468300c1731a76
4
+ data.tar.gz: 1a5a9887fc7c0b9600c453565cb3496db58e2de5
5
5
  SHA512:
6
- metadata.gz: 295ec1527e81d7c5954dd949cb084b65c3c634bccacaed32a2ca16b8e86e5d4d1bb1ec6f759a523b201a4023d0b0e1d54d69e09c44f9a999240fece436b90306
7
- data.tar.gz: d7d06b06eb69cc307900a9a3e6833815d61d7fa694b7830456d9d079560b3f13ec8395c30e0f041debfebd939417aad28adbbf330504e462f333dfd13ac4c570
6
+ metadata.gz: 958052ea9ea084cc0bcba112f41e6de68d9395d5d4e711c0ccc394ad4c82e628463bbd18cd0c1b231c5f906e42c682b7d191aa59a698283d0316d95b549e39fe
7
+ data.tar.gz: 6dc33d748019010708d9676bc793717a4e54289e11eb74344478384d48b638077164e6a97a41230a1119f5545a492fb3c2e7fd984bab51d08dafac2f44f4c090
data/README.md CHANGED
@@ -32,6 +32,8 @@ puts "Method 1 duration : #{MicroBench.duration} seconds"
32
32
  method_2(foo)
33
33
  ```
34
34
 
35
+ **WARNING : This is still beta code and may not be suitable for production usage. While still in beta, API may be subject to breaking changes on MINOR versions (but not on PATCH versions).**
36
+
35
37
  ## Install
36
38
 
37
39
  ```
@@ -116,6 +118,8 @@ method_1
116
118
 
117
119
  We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/klaxit/micro_bench/tags).
118
120
 
121
+ While still in beta (before `1.0.0`), API may be subject to breaking changes on MINOR versions (but not on PATCH versions).
122
+
119
123
  ## Authors
120
124
 
121
125
  See the list of [contributors](https://github.com/klaxit/micro_bench/contributors) who participated in this project.
@@ -1,3 +1,3 @@
1
1
  module MicroBench
2
- VERSION = "0.1.2".freeze
2
+ VERSION = "0.1.3".freeze
3
3
  end
data/lib/micro_bench.rb CHANGED
@@ -73,7 +73,7 @@ module MicroBench
73
73
  caller_location = caller_locations(2..4).detect do |loc|
74
74
  !loc.absolute_path.include?(__FILE__)
75
75
  end
76
- "#{caller_location.absolute_path}:#{caller_location.label}"
76
+ "#{caller_location.absolute_path}:#{caller_location.base_label}"
77
77
  end
78
78
  end
79
79
  end
@@ -90,4 +90,24 @@ describe MicroBench do
90
90
  expect(subject.method_1_duration).to_not eq(subject.method_2_duration)
91
91
  end
92
92
 
93
+ it "allows referencing a benchmark from a Proc / Block / Lambda" do
94
+ MicroBench.start
95
+ # from a Proc
96
+ proc = Proc.new do
97
+ expect(MicroBench.duration).to_not be_nil
98
+ end
99
+ proc.call
100
+ # from a Block
101
+ def my_method
102
+ yield
103
+ end
104
+ my_method do
105
+ expect(MicroBench.duration).to_not be_nil
106
+ end
107
+ # from a Lambda
108
+ l = lambda do
109
+ expect(MicroBench.duration).to_not be_nil
110
+ end
111
+ l.call
112
+ end
93
113
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: micro_bench
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyrille Courtière
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-02 00:00:00.000000000 Z
11
+ date: 2018-12-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug