vv 0.0.20 → 0.0.21

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f74195fa46ae24a1e10dde49b9f8af256f73b13181ec843d8dbd1afc3f17fcf0
4
- data.tar.gz: dcd20d147b62ef6d04b5bfbd952e3a0b74110b9aefe75a63872c8467ee8909e9
3
+ metadata.gz: 45385f2294a3cd3eb7478ee189e433a1057ae3b6fd2023e7518b9938e8994c29
4
+ data.tar.gz: b08afb6418c4beeac35f401cbd206c5dc3abdfe8345d81dc422e06b39f7dcd90
5
5
  SHA512:
6
- metadata.gz: 626d2fe8d870cff9e4f6b5a97e8986a2a45b925f133df4efeb57d10385e9caebab427c9e280dde0cb4908050414fc7217ffc18ff66959d05eb14803abadadce8
7
- data.tar.gz: b7e50f23643d1eb1206fffc1e865e52c261df5558a661cbde2007dfc294cd969ea9a612294ad196ba67fc4b3626fc963c2208e534fcc4487596915a9fb16b358
6
+ metadata.gz: 917e3487dfc6f0f4f81e4d5e6296fd433d70f69e39a3a5d4214666635e03833c52da9ae7c346e4b0f6c8915fe92370e060b046716c54c2de3a6abd778d9321d8
7
+ data.tar.gz: e684109e18218d80c3aca0c5eeea81d9a05e0fa4163bf14f8f0b8f5cdb88027acf7e3ddf4a3a194d986bc3626387a8708ae5e7886e88d3e4adf23c6531619e3b
data/lib/vv.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "time"
1
2
  require "json"
2
3
  require "securerandom"
3
4
  require "readline"
@@ -78,3 +79,7 @@ class Random
78
79
  include VV::RandomMethods
79
80
  extend VV::RandomClassSettings
80
81
  end
82
+
83
+ class Time
84
+ include VV::TimeMethods
85
+ end
@@ -332,6 +332,18 @@ module VV
332
332
  self.parse notation: :json
333
333
  end
334
334
 
335
+ def to_time
336
+ message = "Incorrect time string formatting `#{self}`, " + \
337
+ "must be of the form `2020-02-20T11:22:33.4567Z`"
338
+
339
+ fail message unless self.ends_with? "Z"
340
+ fail message unless self.split(String.dash).count == 3
341
+ fail message unless self.split(String.colon).count == 3
342
+ fail message unless self[10] == "T"
343
+
344
+ Time.parse self
345
+ end
346
+
335
347
  def to_h parse: :json, symbolize_keys: false
336
348
  message = "Only JSON support at this time."
337
349
  fail NotImplementedError, message unless parse == :json
@@ -0,0 +1,21 @@
1
+ module VV
2
+ module TimeMethods
3
+
4
+ def self.included(base)
5
+ base.instance_eval do
6
+ extend(ClassMethods)
7
+ alias_method :second, :sec
8
+ alias_method :sub_second, :subsec
9
+ end
10
+ end
11
+
12
+ module ClassMethods
13
+
14
+ def vv_included?
15
+ true
16
+ end
17
+
18
+ end
19
+
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module VV
2
- VERSION = '0.0.20'
2
+ VERSION = '0.0.21'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.20
4
+ version: 0.0.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zach Aysan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-23 00:00:00.000000000 Z
11
+ date: 2019-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -86,6 +86,7 @@ files:
86
86
  - lib/vv/style/italic.rb
87
87
  - lib/vv/style/underline.rb
88
88
  - lib/vv/symbol_methods.rb
89
+ - lib/vv/time_methods.rb
89
90
  - lib/vv/true_methods.rb
90
91
  - lib/vv/utility/automate.rb
91
92
  - lib/vv/utility/lookup_table.rb