easy_timer 0.0.1 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -8
- data/lib/easy_timer/version.rb +1 -1
- metadata +1 -1
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# EasyTimer
|
2
2
|
|
3
|
-
|
3
|
+
A simple and elegant way to add timer functionality to your projects. Adds class method timer and instance method verbose to Time class.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -19,22 +19,22 @@ Or install it yourself as:
|
|
19
19
|
## Usage
|
20
20
|
Calling timer will return a time object.
|
21
21
|
|
22
|
-
|
22
|
+
Time.timer{sleep 1} #=> Time object
|
23
23
|
|
24
24
|
Calling verbose on a Time object will return a formatted string.
|
25
25
|
|
26
|
-
|
26
|
+
Time.timer{sleep 1}.verbose #=> 1.00 seconds
|
27
27
|
|
28
28
|
You can also pass :v => true or :verbose => true.
|
29
29
|
|
30
|
-
|
30
|
+
Time.timer(:v => true){sleep 1} #=> 1.00 seconds
|
31
31
|
|
32
32
|
A practical usage would be:
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
34
|
+
puts Time.timer do
|
35
|
+
Model.update_all({:criteria => false}, {:criteria => true})
|
36
|
+
puts "All models with criteria=false have been updated."
|
37
|
+
end.verbose
|
38
38
|
|
39
39
|
|
40
40
|
## Contributing
|
data/lib/easy_timer/version.rb
CHANGED