hellobase 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hellobase.rb +1 -1
- data/lib/hellobase/date_creation.rb +3 -3
- data/lib/hellobase/datetime_creation.rb +8 -4
- data/lib/hellobase/time_creation.rb +3 -3
- data/lib/hellobase/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: c9a3bef090b09fe7abe292328fa8b00651b5848175316252dade58061967cb26
|
4
|
+
data.tar.gz: 11b1384b3789910fe052ee4ae90d9d74253d917aefff90895a24caec54226566
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5bd340087ddc083027a3eefbf14c5874646399652891f522fda9d5a988886ff5724cfd1a8861a208a13044af70d98dfe7f08aba11a5a4c9b3b3e641735a6f7e
|
7
|
+
data.tar.gz: 23e2691a82055e76dc64cbd464bfe739de824c1843805a8ee4ad6e2c0a2114522952aeb39163068b7d5f6910378adc7fb0c5f549bbc91e185b75737175cc9c3b
|
data/lib/hellobase.rb
CHANGED
@@ -15,7 +15,7 @@ require 'hellobase/time_creation'
|
|
15
15
|
module Hellobase
|
16
16
|
DATE_FORMAT = /^\d{4}-\d{2}-\d{2}$/
|
17
17
|
TIME_FORMAT = /^\d{2}:\d{2}:\d{2}$/
|
18
|
-
DATETIME_FORMAT = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/
|
18
|
+
DATETIME_FORMAT = /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} UTC$/
|
19
19
|
|
20
20
|
class Error < StandardError
|
21
21
|
attr_reader :type, :object
|
@@ -1,12 +1,12 @@
|
|
1
1
|
Date.singleton_class.prepend(
|
2
2
|
Module.new do
|
3
3
|
def parse(string)
|
4
|
-
raise Hellobase::Error.new(:
|
4
|
+
raise Hellobase::Error.new(:date_format, nil, string) unless string =~ Hellobase::DATE_FORMAT
|
5
5
|
|
6
6
|
begin
|
7
7
|
super
|
8
8
|
rescue ArgumentError
|
9
|
-
raise Hellobase::Error.new(:
|
9
|
+
raise Hellobase::Error.new(:date_value, nil, string)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -14,7 +14,7 @@ Date.singleton_class.prepend(
|
|
14
14
|
begin
|
15
15
|
super
|
16
16
|
rescue ArgumentError
|
17
|
-
raise Hellobase::Error.new(:
|
17
|
+
raise Hellobase::Error.new(:date_value, nil, *args)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
@@ -1,21 +1,25 @@
|
|
1
1
|
Time.singleton_class.prepend(
|
2
2
|
Module.new do
|
3
3
|
def parse(string)
|
4
|
-
raise Hellobase::Error.new(:
|
4
|
+
raise Hellobase::Error.new(:datetime_format, nil, string) unless string =~ Hellobase::DATETIME_FORMAT
|
5
5
|
|
6
6
|
begin
|
7
7
|
super
|
8
8
|
rescue ArgumentError
|
9
|
-
raise Hellobase::Error.new(:
|
9
|
+
raise Hellobase::Error.new(:datetime_value, nil, string)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
def
|
13
|
+
def utc(*args)
|
14
14
|
begin
|
15
15
|
super
|
16
16
|
rescue ArgumentError
|
17
|
-
raise Hellobase::Error.new(:
|
17
|
+
raise Hellobase::Error.new(:datetime_value, nil, *args)
|
18
18
|
end
|
19
19
|
end
|
20
|
+
|
21
|
+
def new(*args)
|
22
|
+
raise Hellobase::Error.new(:datetime_new, nil)
|
23
|
+
end
|
20
24
|
end
|
21
25
|
)
|
@@ -1,12 +1,12 @@
|
|
1
1
|
Tod::TimeOfDay.singleton_class.prepend(
|
2
2
|
Module.new do
|
3
3
|
def parse(string)
|
4
|
-
raise Hellobase::Error.new(:
|
4
|
+
raise Hellobase::Error.new(:time_format, nil, string) unless string =~ Hellobase::TIME_FORMAT
|
5
5
|
|
6
6
|
begin
|
7
7
|
super
|
8
8
|
rescue ArgumentError
|
9
|
-
raise Hellobase::Error.new(:
|
9
|
+
raise Hellobase::Error.new(:time_value, nil, string)
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
@@ -14,7 +14,7 @@ Tod::TimeOfDay.singleton_class.prepend(
|
|
14
14
|
begin
|
15
15
|
super
|
16
16
|
rescue ArgumentError
|
17
|
-
raise Hellobase::Error.new(:
|
17
|
+
raise Hellobase::Error.new(:time_value, nil, *args)
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
data/lib/hellobase/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hellobase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anthony Wang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|