code-ruby 1.6.0 → 1.6.1
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 +4 -4
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/code/object/date.rb +24 -4
- data/lib/code/object/dictionary.rb +1 -1
- data/lib/code/object/http.rb +1 -1
- data/lib/code/object/list.rb +1 -1
- data/lib/code/object/time.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f8a1afa22e9271512b0bef2197c9036cd85cab51dbd9dea4f1c7954ea1b4130
|
4
|
+
data.tar.gz: 5b711b476024c29ec4d9eeb4f6d9d1c741b488b1a9816cd38b9220d6fe093e01
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0af9ea0b81e48d9b7ada87302ca5ff2bd6f4d8264bb9d968baa21173c34f69140ca047bbd5d95f440aa1e4eb50e7347ed9c19ad98f89fe8a9e9d2da0c1730a14
|
7
|
+
data.tar.gz: 61817cefd553d497fe30651d3fb9909c26681207c6831701cf1ab2bc050319c94af9b371e552ac501d880590880b1e47aa1f6dd69d70e595d656dd8778f5424f
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.1
|
data/lib/code/object/date.rb
CHANGED
@@ -7,6 +7,9 @@ class Code
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
delegate(
|
10
|
+
:code_format,
|
11
|
+
:code_past?,
|
12
|
+
:code_future?,
|
10
13
|
:code_add,
|
11
14
|
:code_substract,
|
12
15
|
:code_before?,
|
@@ -76,8 +79,25 @@ class Code
|
|
76
79
|
|
77
80
|
def self.call(**args)
|
78
81
|
code_operator = args.fetch(:operator, nil).to_code
|
82
|
+
code_arguments = args.fetch(:arguments, []).to_code
|
83
|
+
code_value = code_arguments.code_first
|
79
84
|
|
80
85
|
case code_operator.to_s
|
86
|
+
when "after?"
|
87
|
+
sig(args) { (Date | Time).maybe }
|
88
|
+
code_after?(code_value)
|
89
|
+
when "before?"
|
90
|
+
sig(args) { (Date | Time).maybe }
|
91
|
+
code_before?(code_value)
|
92
|
+
when "past?"
|
93
|
+
sig(args)
|
94
|
+
code_past?
|
95
|
+
when "future?"
|
96
|
+
sig(args)
|
97
|
+
code_future?
|
98
|
+
when "format"
|
99
|
+
sig(args) { String }
|
100
|
+
code_format(code_value)
|
81
101
|
when "tomorrow"
|
82
102
|
sig(args)
|
83
103
|
code_tomorrow
|
@@ -276,10 +296,10 @@ class Code
|
|
276
296
|
|
277
297
|
case code_operator.to_s
|
278
298
|
when "after?"
|
279
|
-
sig(args) { Time.maybe }
|
299
|
+
sig(args) { (Date | Time).maybe }
|
280
300
|
code_after?(code_value)
|
281
301
|
when "before?"
|
282
|
-
sig(args) { Time.maybe }
|
302
|
+
sig(args) { (Date | Time).maybe }
|
283
303
|
code_before?(code_value)
|
284
304
|
when "past?"
|
285
305
|
sig(args)
|
@@ -468,14 +488,14 @@ class Code
|
|
468
488
|
|
469
489
|
def code_after?(other = nil)
|
470
490
|
code_other = other.to_code
|
471
|
-
code_other = Date.
|
491
|
+
code_other = Date.new if code_other.nothing?
|
472
492
|
|
473
493
|
Boolean.new(raw.after?(code_other.raw))
|
474
494
|
end
|
475
495
|
|
476
496
|
def code_before?(other = nil)
|
477
497
|
code_other = other.to_code
|
478
|
-
code_other = Date.
|
498
|
+
code_other = Date.new if code_other.nothing?
|
479
499
|
|
480
500
|
Boolean.new(raw.before?(code_other.raw))
|
481
501
|
end
|
data/lib/code/object/http.rb
CHANGED
@@ -202,7 +202,7 @@ class Code
|
|
202
202
|
code = response.code.to_i
|
203
203
|
status = STATUS_CODES.key(code) || :ok
|
204
204
|
|
205
|
-
Dictionary.new(code: code, status: status, body: response.body)
|
205
|
+
Dictionary.new(code: code, status: status, body: response.body.to_s)
|
206
206
|
end
|
207
207
|
end
|
208
208
|
end
|
data/lib/code/object/list.rb
CHANGED
data/lib/code/object/time.rb
CHANGED
@@ -7,6 +7,7 @@ class Code
|
|
7
7
|
|
8
8
|
class << self
|
9
9
|
delegate(
|
10
|
+
:code_format,
|
10
11
|
:code_add,
|
11
12
|
:code_substract,
|
12
13
|
:code_past?,
|
@@ -619,14 +620,14 @@ class Code
|
|
619
620
|
|
620
621
|
def code_after?(other = nil)
|
621
622
|
code_other = other.to_code
|
622
|
-
code_other = Time.
|
623
|
+
code_other = Time.new if code_other.nothing?
|
623
624
|
|
624
625
|
Boolean.new(raw.after?(code_other.raw))
|
625
626
|
end
|
626
627
|
|
627
628
|
def code_before?(other = nil)
|
628
629
|
code_other = other.to_code
|
629
|
-
code_other = Time.
|
630
|
+
code_other = Time.new if code_other.nothing?
|
630
631
|
|
631
632
|
Boolean.new(raw.before?(code_other.raw))
|
632
633
|
end
|