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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d491d1f3a4df259dd3f5f08b9757082d16029d52695442273bd8e3946d07615b
4
- data.tar.gz: bc77e6dd598a7800d7e7abe7bde39fcae5a941edea9b483df499c39c2b37b05e
3
+ metadata.gz: 27a794afbfbfe0bfaf840de437f9a95bfccbf610b15eb8943f2f1b1accd3a0b6
4
+ data.tar.gz: 12abaae99b33487a43c79a5fc8c2bd0fada233e78d2e2441c21ef941915c8825
5
5
  SHA512:
6
- metadata.gz: 24d51fda2095cbe7a2e0fd9217404ecbab715193529d92b2ddae93c648b09013f3c022712f326f66e0f3cd6f5426f85f6c41a5e1cc28134144c4bb774c26d59b
7
- data.tar.gz: 6b7c5b3ab9552381c50b4e4bc8cdaf8eca96077b1d53687353ab85dac1594810a097dabf2975f5b27fd2c22a3c21d5b953ac328f28f355a8e49df28ad8059b4b
6
+ metadata.gz: 12d718c1704723f92da50451cf3d12db6111dcc20c18002f4f286885d20d0ea3c7ef9b74c2f8de551521ca06580f6489783436d1530bbbb30331cce6d5489356
7
+ data.tar.gz: 96f8f4194280cd801fe0ebbcd0fd05edfc8d2294505acd5b77dbd960cd6e4310e5b3b5735af5431400b1241f369867e251cc4a5b46cd523bf21d5070be4f047c
@@ -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.4] - 2019-08-010
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-010
18
+ ## [1.0.4] - 2019-08-10
15
19
  ### Added
16
20
  - Added more boolean value checks
17
21
  - Added Numeric => `markdown_percentage`
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-ruby (1.0.5)
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.3)
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)
@@ -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
- ```
@@ -7,10 +7,14 @@ class Time
7
7
 
8
8
  class << self
9
9
 
10
- def elapse
11
- time = now.to_f
10
+ def elapse(verbose: false)
11
+ started_at = now.to_f
12
12
  yield
13
- now.to_f - time
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
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Ruby
5
5
 
6
- VERSION ||= '1.0.5'
6
+ VERSION ||= '1.0.6'
7
7
 
8
8
  end
9
9
  end
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.5
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-10 00:00:00.000000000 Z
11
+ date: 2019-08-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler