vv 0.0.20 → 0.0.21
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vv.rb +5 -0
- data/lib/vv/string_methods.rb +12 -0
- data/lib/vv/time_methods.rb +21 -0
- data/lib/vv/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45385f2294a3cd3eb7478ee189e433a1057ae3b6fd2023e7518b9938e8994c29
|
4
|
+
data.tar.gz: b08afb6418c4beeac35f401cbd206c5dc3abdfe8345d81dc422e06b39f7dcd90
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 917e3487dfc6f0f4f81e4d5e6296fd433d70f69e39a3a5d4214666635e03833c52da9ae7c346e4b0f6c8915fe92370e060b046716c54c2de3a6abd778d9321d8
|
7
|
+
data.tar.gz: e684109e18218d80c3aca0c5eeea81d9a05e0fa4163bf14f8f0b8f5cdb88027acf7e3ddf4a3a194d986bc3626387a8708ae5e7886e88d3e4adf23c6531619e3b
|
data/lib/vv.rb
CHANGED
data/lib/vv/string_methods.rb
CHANGED
@@ -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
|
data/lib/vv/version.rb
CHANGED
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.
|
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-
|
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
|