matiox 0.0.0.1 → 0.0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/lib/matiox.rb +11 -1
- data/lib/matiox/errors.rb +8 -0
- data/lib/matiox/initializers/default.rb +52 -0
- data/lib/matiox/initializers/from_gregorian.rb +19 -0
- data/lib/matiox/sunrise.rb +5 -0
- data/lib/matiox/timezone.rb +5 -0
- data/lib/matiox/version.rb +3 -0
- metadata +9 -4
- data/README.md +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f930992ab09baea5f1f0d0dfb7f891ce9a161bab31ff5435757c05a6f823bff4
|
4
|
+
data.tar.gz: cd8b66cf5994a0b7eb10eafe146368595e544e353097b1d9184f75d74192ebf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45eaa6c0d1ba1a1b3e2e8403edb19046cb237b715e2181ce3cccc17ac60653d022bf24c0395841e482032beee25a497f5e9a31028334407709c5b1e973c12c92
|
7
|
+
data.tar.gz: 45186628cf5407ad00938d1a47990ae2b38dc5b6ea37c84fc9b57949ecce0e66426807383acdd872b47c7ae50e81655a802f68d1885173c64f498611665745a8
|
data/lib/matiox.rb
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
-
|
1
|
+
require 'date'
|
2
|
+
|
3
|
+
require_relative 'matiox/errors'
|
4
|
+
require_relative 'matiox/initializers/default'
|
5
|
+
require_relative 'matiox/initializers/from_gregorian'
|
6
|
+
|
7
|
+
class Matiox
|
8
|
+
|
9
|
+
attr_reader :gregorian
|
10
|
+
|
11
|
+
include Initializers
|
2
12
|
|
3
13
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
class Matiox
|
2
|
+
module Initializers
|
3
|
+
|
4
|
+
def initialize(date=nil)
|
5
|
+
|
6
|
+
case date
|
7
|
+
|
8
|
+
when DateTime
|
9
|
+
|
10
|
+
@gregorian = date
|
11
|
+
|
12
|
+
when Time
|
13
|
+
|
14
|
+
seconds = date.sec + Rational(date.usec, 10**6)
|
15
|
+
offset = Rational(date.utc_offset, 60 * 60 * 24)
|
16
|
+
@gregorian = DateTime.new(
|
17
|
+
date.year,
|
18
|
+
date.month,
|
19
|
+
date.day,
|
20
|
+
date.hour,
|
21
|
+
date.min,
|
22
|
+
seconds,
|
23
|
+
offset
|
24
|
+
)
|
25
|
+
|
26
|
+
|
27
|
+
#de TODO: Move these into their own self.from_ methods and invoke in general initializer here:
|
28
|
+
#de TODO: Use Regular expressions?
|
29
|
+
when String
|
30
|
+
|
31
|
+
begin
|
32
|
+
@gregorian = DateTime.strptime(date, '%Y-%m-%dT%H:%M:%S%z')
|
33
|
+
rescue
|
34
|
+
begin
|
35
|
+
@gregorian = DateTime.strptime(date, '%Y-%m-%d %H:%M:%S')
|
36
|
+
rescue
|
37
|
+
begin
|
38
|
+
@gregorian = DateTime.strptime(date, '%Y-%m-%d')
|
39
|
+
rescue
|
40
|
+
raise Matiox::Error::GregorianDate::IncorrectlyFormatted.new("Bad date string: #{date}")
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
else
|
46
|
+
@gregorian = DateTime.now
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Matiox
|
2
|
+
module Initializers
|
3
|
+
class << self
|
4
|
+
|
5
|
+
def from_ymdhms(date)
|
6
|
+
raise Error::NotYetImplemented
|
7
|
+
end
|
8
|
+
|
9
|
+
def from_ymd(date)
|
10
|
+
raise Error::NotYetImplemented
|
11
|
+
end
|
12
|
+
|
13
|
+
def from_iso8601(date)
|
14
|
+
raise Error::NotYetImplemented
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: matiox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.0.
|
4
|
+
version: 0.0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donovan Keme
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby gem for Aj'kij daykeepers and uninitiated alike.
|
14
14
|
email:
|
@@ -17,8 +17,13 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- README.md
|
21
20
|
- lib/matiox.rb
|
21
|
+
- lib/matiox/errors.rb
|
22
|
+
- lib/matiox/initializers/default.rb
|
23
|
+
- lib/matiox/initializers/from_gregorian.rb
|
24
|
+
- lib/matiox/sunrise.rb
|
25
|
+
- lib/matiox/timezone.rb
|
26
|
+
- lib/matiox/version.rb
|
22
27
|
homepage: http://github.com/digitalextremist/matiox
|
23
28
|
licenses: []
|
24
29
|
metadata: {}
|
@@ -38,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
38
43
|
version: '0'
|
39
44
|
requirements: []
|
40
45
|
rubyforge_project:
|
41
|
-
rubygems_version: 2.
|
46
|
+
rubygems_version: 2.7.6.2
|
42
47
|
signing_key:
|
43
48
|
specification_version: 4
|
44
49
|
summary: Advanced Chol'qij library.
|