timify 0.0.4 → 0.0.5
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 +5 -5
- data/README.md +6 -0
- data/lib/timify.rb +4 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 224c8980c101be7c0b632430f760cd4902cd0e7e80893c1971ee0755c45984d4
|
4
|
+
data.tar.gz: e2f6e3e167cd555a6a9d11ecacf55a19895d26e7f5cd92aee0412ee41e8ff5cf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a96a8730523624686027f4678d4fe48420aa8a96a25203dd11f1445a09ca155957061f7801365f51c0a290ffe13b377f2763b3fe3988c1ae2d414571ce4cda6d
|
7
|
+
data.tar.gz: decee0e39f1b680907094a5eafe11bd05bc3127cb22ca7e7c320e1818eed13362d8fa04a0aca00f39fbf8b9234135e8b629059509cefcbcb284e9a72e2774ccd
|
data/README.md
CHANGED
@@ -42,6 +42,12 @@ t = Timify.new :create_user, show: true, min_time_to_show: 0.3
|
|
42
42
|
|
43
43
|
The scopes of the instances can be even global so you can measure the elapsed times between different classes, methods... on your code.
|
44
44
|
|
45
|
+
You can disable the timify counter whenever you want using the status attritute that admits :on or :off, by default is set to :on
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
t.status = :off
|
49
|
+
```
|
50
|
+
|
45
51
|
### add
|
46
52
|
|
47
53
|
Adds a new point to count the elapsed time. It will count from the last 'add' call or Timify creation in case of the first 'add'.
|
data/lib/timify.rb
CHANGED
@@ -4,6 +4,7 @@
|
|
4
4
|
# attr_accessor:
|
5
5
|
# min_time_to_show: minimum time to show the elapsed time when calling 'add' method
|
6
6
|
# show: print out results on screen
|
7
|
+
# status: (default :on) You can set :on or :off the status so it will counting the time or not
|
7
8
|
#
|
8
9
|
# attr_reader:
|
9
10
|
# name: name given for the Timify instance
|
@@ -12,7 +13,7 @@
|
|
12
13
|
# max_time_spent: maximum time measured for this instance
|
13
14
|
###############################################################
|
14
15
|
class Timify
|
15
|
-
attr_accessor :min_time_to_show, :show
|
16
|
+
attr_accessor :min_time_to_show, :show, :status
|
16
17
|
attr_reader :name, :total, :initial_time, :max_time_spent
|
17
18
|
|
18
19
|
###############################################################
|
@@ -64,6 +65,7 @@ class Timify
|
|
64
65
|
# do_log(t.totals[:message]) if t.add > 0.5
|
65
66
|
###############################################################
|
66
67
|
def add(*label)
|
68
|
+
return 0 if @status==:off
|
67
69
|
if !label.empty?
|
68
70
|
label=label[0]
|
69
71
|
else
|
@@ -128,6 +130,7 @@ class Timify
|
|
128
130
|
# ranges: (Hash) All summary data by ranges where was called, from last 'add' call to current 'add' call
|
129
131
|
###############################################################
|
130
132
|
def totals(json: false)
|
133
|
+
return {} if @status==:off
|
131
134
|
require 'json' if json
|
132
135
|
output={
|
133
136
|
name: @name,
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Ruiz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
|
-
description: Easily
|
13
|
+
description: Easily calculate the time running (elapsed time) from one location to
|
14
14
|
another inside your code and reports statistics. It helps you improve your code
|
15
15
|
and find out which part of your code is consuming more time.
|
16
16
|
email: marioruizs@gmail.com
|
@@ -44,9 +44,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
44
44
|
version: '0'
|
45
45
|
requirements: []
|
46
46
|
rubyforge_project:
|
47
|
-
rubygems_version: 2.6
|
47
|
+
rubygems_version: 2.7.6
|
48
48
|
signing_key:
|
49
49
|
specification_version: 4
|
50
|
-
summary: Easily
|
50
|
+
summary: Easily calculate the time running (elapsed time) from one location to another
|
51
51
|
inside your code and reports statistics.
|
52
52
|
test_files: []
|