lite-ruby 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -2
- data/Gemfile.lock +2 -2
- data/docs/TIME.md +9 -8
- data/lib/lite/ruby/time.rb +7 -3
- data/lib/lite/ruby/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 27a794afbfbfe0bfaf840de437f9a95bfccbf610b15eb8943f2f1b1accd3a0b6
|
4
|
+
data.tar.gz: 12abaae99b33487a43c79a5fc8c2bd0fada233e78d2e2441c21ef941915c8825
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12d718c1704723f92da50451cf3d12db6111dcc20c18002f4f286885d20d0ea3c7ef9b74c2f8de551521ca06580f6489783436d1530bbbb30331cce6d5489356
|
7
|
+
data.tar.gz: 96f8f4194280cd801fe0ebbcd0fd05edfc8d2294505acd5b77dbd960cd6e4310e5b3b5735af5431400b1241f369867e251cc4a5b46cd523bf21d5070be4f047c
|
data/CHANGELOG.md
CHANGED
@@ -6,12 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
-
## [1.0.
|
9
|
+
## [1.0.6] - 2019-08-14
|
10
|
+
### Changed
|
11
|
+
- Add verbose option to Time elapse
|
12
|
+
|
13
|
+
## [1.0.5] - 2019-08-10
|
10
14
|
### Changed
|
11
15
|
- Improved speed for Array denillify
|
12
16
|
- Improved speed for Hash denillify
|
13
17
|
|
14
|
-
## [1.0.4] - 2019-08-
|
18
|
+
## [1.0.4] - 2019-08-10
|
15
19
|
### Added
|
16
20
|
- Added more boolean value checks
|
17
21
|
- Added Numeric => `markdown_percentage`
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lite-ruby (1.0.
|
4
|
+
lite-ruby (1.0.6)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -46,7 +46,7 @@ GEM
|
|
46
46
|
method_source (0.9.2)
|
47
47
|
mini_portile2 (2.4.0)
|
48
48
|
minitest (5.11.3)
|
49
|
-
nokogiri (1.10.
|
49
|
+
nokogiri (1.10.4)
|
50
50
|
mini_portile2 (~> 2.4.0)
|
51
51
|
parallel (1.17.0)
|
52
52
|
parser (2.6.3.0)
|
data/docs/TIME.md
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# Time
|
2
2
|
|
3
|
+
`elapse`
|
4
|
+
------
|
5
|
+
Returns the amount of time taken to execute a block.
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
Time.elapse { sleep 1 } #=> 1.00005465
|
9
|
+
Time.elapse(verbose: true) { sleep 1 } #=> { started_at: 1565834550.444132, ended_at: 1565834551.447784, runtime: 1.0036518573760986 }
|
10
|
+
```
|
11
|
+
|
3
12
|
`format`
|
4
13
|
------
|
5
14
|
Converts a `time` object to `strftime` it using a human readable string.
|
@@ -84,11 +93,3 @@ Converts a `time` object to a predefined format.
|
|
84
93
|
```ruby
|
85
94
|
Time.now.stamp(:datetime) #=> 'January 09, 2014 02:31 pm'
|
86
95
|
```
|
87
|
-
|
88
|
-
`elapse`
|
89
|
-
------
|
90
|
-
Returns the amount of time taken to execute a block.
|
91
|
-
|
92
|
-
```ruby
|
93
|
-
Time.elapse { sleep 1 } #=> 1.00005465
|
94
|
-
```
|
data/lib/lite/ruby/time.rb
CHANGED
@@ -7,10 +7,14 @@ class Time
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
|
10
|
-
def elapse
|
11
|
-
|
10
|
+
def elapse(verbose: false)
|
11
|
+
started_at = now.to_f
|
12
12
|
yield
|
13
|
-
now.to_f
|
13
|
+
ended_at = now.to_f
|
14
|
+
runtime = ended_at - started_at
|
15
|
+
return runtime unless verbose
|
16
|
+
|
17
|
+
{ started_at: started_at, ended_at: ended_at, runtime: runtime }
|
14
18
|
end
|
15
19
|
|
16
20
|
end
|
data/lib/lite/ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lite-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Juan Gomez
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-08-
|
11
|
+
date: 2019-08-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|