benchmark_methods 0.3 → 0.4
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 +4 -4
- data/.gitignore +2 -1
- data/README.md +1 -0
- data/lib/benchmark_methods.rb +3 -3
- data/lib/benchmark_methods/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e1a6220ccd23af9146e6550a80454ead459912b
|
4
|
+
data.tar.gz: ddc641ef6c81e9e8e459dd6f7681f9fc829e7b84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e6c9763209bc637633b9de7f7c8ad5f571e681b395ce92ac7d5532d7c61c2ecafd53ab1ef862f19dc2cf567578dfeed9216d16a044608741707cc22dfa2f3cd
|
7
|
+
data.tar.gz: 9b5b5f81d42a80c061bc15c5779f6f977d5d35e0b46e95178dcaa40f1cac56e0b9e01eef001268313a5b4ce081ca9de6a314c47b2cd5129f9601b649a22136d8
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
Measure and benchmark execution time of your ruby methods. Forgot about `Time.now - t` solution. Use `benchmark` to see how much time it takes to execute your method.
|
4
4
|
|
5
5
|
[](https://travis-ci.org/igorkasyanchuk/benchmark_methods)
|
6
|
+
[](https://badge.fury.io/rb/benchmark_methods)
|
6
7
|
|
7
8
|
Sample or usage:
|
8
9
|
|
data/lib/benchmark_methods.rb
CHANGED
@@ -5,15 +5,15 @@ require 'benchmark_methods/version'
|
|
5
5
|
module BenchmarkMethods
|
6
6
|
|
7
7
|
def self.included(base_klass)
|
8
|
-
base_klass.
|
9
|
-
|
8
|
+
unless const_defined?("#{base_klass.name.demodulize}Interceptor")
|
9
|
+
base_klass.extend(ClassMethods)
|
10
10
|
interceptor = const_set("#{base_klass.name.demodulize}Interceptor", Module.new)
|
11
11
|
base_klass.send(:prepend, interceptor)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.log(report)
|
16
|
-
if
|
16
|
+
if const_defined?("Rails")
|
17
17
|
Rails.logger.debug(" --> #{report.label}")
|
18
18
|
Rails.logger.debug("#{Benchmark::CAPTION}#{report.to_s}")
|
19
19
|
else
|