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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c056c67f03842581b5c4a106cb6147d2cfb4eefea75c2bb187112e04adc44851
4
- data.tar.gz: 1c61bb7ccb9b0a1b29a76cf9405c70ba94d740f77db9c9003662b4401e4d4293
3
+ metadata.gz: 9f8a1afa22e9271512b0bef2197c9036cd85cab51dbd9dea4f1c7954ea1b4130
4
+ data.tar.gz: 5b711b476024c29ec4d9eeb4f6d9d1c741b488b1a9816cd38b9220d6fe093e01
5
5
  SHA512:
6
- metadata.gz: 7d45064357034d4232410e47bf5edb5bbfda2ea51be5596aabea466ecd796a011abfc7d850761319deb37e7d2f391852ca0cd8699c82c8a4e9b0f38e2dc6904b
7
- data.tar.gz: 65580e08bae19b1e190a49b44e7d67c2ad05ceb18cda8b4e90efa9a02333fa1bc6216beeefd62d777178a88632562cb737076be7273c4cb500ef3783f7bb9b72
6
+ metadata.gz: 0af9ea0b81e48d9b7ada87302ca5ff2bd6f4d8264bb9d968baa21173c34f69140ca047bbd5d95f440aa1e4eb50e7347ed9c19ad98f89fe8a9e9d2da0c1730a14
7
+ data.tar.gz: 61817cefd553d497fe30651d3fb9909c26681207c6831701cf1ab2bc050319c94af9b371e552ac501d880590880b1e47aa1f6dd69d70e595d656dd8778f5424f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- code-ruby (1.6.0)
4
+ code-ruby (1.6.1)
5
5
  activesupport
6
6
  base64
7
7
  bigdecimal
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.0
1
+ 1.6.1
@@ -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.code_now if code_other.nothing?
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.code_now if code_other.nothing?
498
+ code_other = Date.new if code_other.nothing?
479
499
 
480
500
  Boolean.new(raw.before?(code_other.raw))
481
501
  end
@@ -5,7 +5,7 @@ class Code
5
5
  class Dictionary < ::Code::Object
6
6
  delegate(
7
7
  :code_many?,
8
- :code_postive?,
8
+ :code_positive?,
9
9
  :code_negative?,
10
10
  :code_zero?,
11
11
  :code_one?,
@@ -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
@@ -5,7 +5,7 @@ class Code
5
5
  class List < Object
6
6
  delegate(
7
7
  :code_many?,
8
- :code_postive?,
8
+ :code_positive?,
9
9
  :code_negative?,
10
10
  :code_zero?,
11
11
  :code_one?,
@@ -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.code_now if code_other.nothing?
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.code_now if code_other.nothing?
630
+ code_other = Time.new if code_other.nothing?
630
631
 
631
632
  Boolean.new(raw.before?(code_other.raw))
632
633
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: code-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié