code-ruby 1.5.1 → 1.5.2
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 +26 -26
- data/VERSION +1 -1
- data/lib/code/object/boolean.rb +2 -1
- data/lib/code/object/time.rb +98 -0
- data/spec/code_spec.rb +14 -0
- 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: 581653fe0886e86410048da9af0e26e3f084a6539d6b1320cc5a39709683a561
|
4
|
+
data.tar.gz: 61833954737c769eb64ccb4606023d4fa993ba3832f875dc74476cfb5a9ef1fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7cf5543d7f2290ac8c4980a47b1bdfdbf16f056aaf0e4f9476a4a36a9c72eb021d49534d45c45a92bee63859d2778fbc04dcf8b7093ac66e0acfe719fc297b1
|
7
|
+
data.tar.gz: 16e9a0c4848b02a7e6c9dd04f1b4a0ffc788b262b0bd1a8eddabd0433fac5b2d4a0f6b800debef0107372269fc3803a168dd929e296124b54286bedba345db96
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
code-ruby (1.5.
|
4
|
+
code-ruby (1.5.2)
|
5
5
|
activesupport
|
6
6
|
base64
|
7
7
|
bigdecimal
|
@@ -41,15 +41,15 @@ GEM
|
|
41
41
|
thor (~> 1.0)
|
42
42
|
cmdparse (3.0.7)
|
43
43
|
concurrent-ruby (1.3.5)
|
44
|
-
connection_pool (2.5.
|
44
|
+
connection_pool (2.5.3)
|
45
45
|
crack (1.0.0)
|
46
46
|
bigdecimal
|
47
47
|
rexml
|
48
|
-
csv (3.3.
|
48
|
+
csv (3.3.4)
|
49
49
|
did-you-mean (0.1.1)
|
50
50
|
levenshtein (>= 0.2.0)
|
51
|
-
diff-lcs (1.6.
|
52
|
-
dorian (2.6.
|
51
|
+
diff-lcs (1.6.2)
|
52
|
+
dorian (2.6.4)
|
53
53
|
csv
|
54
54
|
dorian-arguments
|
55
55
|
dorian-eval
|
@@ -76,7 +76,7 @@ GEM
|
|
76
76
|
dorian-to_struct (2.0.2)
|
77
77
|
drb (2.2.1)
|
78
78
|
geom2d (0.4.1)
|
79
|
-
git (3.0.
|
79
|
+
git (3.0.2)
|
80
80
|
activesupport (>= 5.0)
|
81
81
|
addressable (~> 2.8)
|
82
82
|
process_executer (~> 1.3)
|
@@ -86,25 +86,25 @@ GEM
|
|
86
86
|
thor
|
87
87
|
tilt
|
88
88
|
hashdiff (1.1.2)
|
89
|
-
hexapdf (1.
|
89
|
+
hexapdf (1.3.0)
|
90
90
|
cmdparse (~> 3.0, >= 3.0.3)
|
91
91
|
geom2d (~> 0.4, >= 0.4.1)
|
92
92
|
openssl (>= 2.2.1)
|
93
93
|
strscan (>= 3.1.2)
|
94
94
|
i18n (1.14.7)
|
95
95
|
concurrent-ruby (~> 1.0)
|
96
|
-
json (2.
|
97
|
-
language-ruby (1.
|
96
|
+
json (2.12.0)
|
97
|
+
language-ruby (1.2.0)
|
98
98
|
dorian-arguments
|
99
99
|
zeitwerk
|
100
|
-
language_server-protocol (3.17.0.
|
100
|
+
language_server-protocol (3.17.0.5)
|
101
101
|
levenshtein (0.2.2)
|
102
102
|
libv8-node (23.6.1.0)
|
103
103
|
libv8-node (23.6.1.0-arm64-darwin)
|
104
104
|
libv8-node (23.6.1.0-x86_64-linux)
|
105
105
|
lint_roller (1.1.0)
|
106
106
|
logger (1.7.0)
|
107
|
-
mini_portile2 (2.8.
|
107
|
+
mini_portile2 (2.8.9)
|
108
108
|
mini_racer (0.18.1)
|
109
109
|
libv8-node (~> 23.6.1.0)
|
110
110
|
minitest (5.25.5)
|
@@ -112,30 +112,30 @@ GEM
|
|
112
112
|
ruby2_keywords (~> 0.0.1)
|
113
113
|
net-http (0.6.0)
|
114
114
|
uri
|
115
|
-
nokogiri (1.18.
|
115
|
+
nokogiri (1.18.8)
|
116
116
|
mini_portile2 (~> 2.8.2)
|
117
117
|
racc (~> 1.4)
|
118
|
-
nokogiri (1.18.
|
118
|
+
nokogiri (1.18.8-arm64-darwin)
|
119
119
|
racc (~> 1.4)
|
120
|
-
nokogiri (1.18.
|
120
|
+
nokogiri (1.18.8-x86_64-linux-gnu)
|
121
121
|
racc (~> 1.4)
|
122
122
|
openssl (3.3.0)
|
123
123
|
ostruct (0.6.1)
|
124
|
-
parallel (1.
|
125
|
-
parser (3.3.
|
124
|
+
parallel (1.27.0)
|
125
|
+
parser (3.3.8.0)
|
126
126
|
ast (~> 2.4.1)
|
127
127
|
racc
|
128
128
|
prettier_print (1.2.1)
|
129
129
|
prism (1.4.0)
|
130
130
|
process_executer (1.3.0)
|
131
|
-
public_suffix (6.0.
|
131
|
+
public_suffix (6.0.2)
|
132
132
|
racc (1.8.1)
|
133
|
-
rack (3.1.
|
133
|
+
rack (3.1.14)
|
134
134
|
rack-protection (4.1.1)
|
135
135
|
base64 (>= 0.1.0)
|
136
136
|
logger (>= 1.6.0)
|
137
137
|
rack (>= 3.0.0, < 4)
|
138
|
-
rack-session (2.1.
|
138
|
+
rack-session (2.1.1)
|
139
139
|
base64 (>= 0.1.0)
|
140
140
|
rack (>= 3.0.0)
|
141
141
|
rainbow (3.1.1)
|
@@ -149,14 +149,14 @@ GEM
|
|
149
149
|
rspec-mocks (~> 3.13.0)
|
150
150
|
rspec-core (3.13.3)
|
151
151
|
rspec-support (~> 3.13.0)
|
152
|
-
rspec-expectations (3.13.
|
152
|
+
rspec-expectations (3.13.4)
|
153
153
|
diff-lcs (>= 1.2.0, < 2.0)
|
154
154
|
rspec-support (~> 3.13.0)
|
155
|
-
rspec-mocks (3.13.
|
155
|
+
rspec-mocks (3.13.4)
|
156
156
|
diff-lcs (>= 1.2.0, < 2.0)
|
157
157
|
rspec-support (~> 3.13.0)
|
158
|
-
rspec-support (3.13.
|
159
|
-
rubocop (1.75.
|
158
|
+
rspec-support (3.13.3)
|
159
|
+
rubocop (1.75.6)
|
160
160
|
json (~> 2.3)
|
161
161
|
language_server-protocol (~> 3.17.0.2)
|
162
162
|
lint_roller (~> 1.1.0)
|
@@ -167,7 +167,7 @@ GEM
|
|
167
167
|
rubocop-ast (>= 1.44.0, < 2.0)
|
168
168
|
ruby-progressbar (~> 1.7)
|
169
169
|
unicode-display_width (>= 2.4.0, < 4.0)
|
170
|
-
rubocop-ast (1.44.
|
170
|
+
rubocop-ast (1.44.1)
|
171
171
|
parser (>= 3.3.7.2)
|
172
172
|
prism (~> 1.4)
|
173
173
|
rubocop-capybara (2.22.1)
|
@@ -189,7 +189,7 @@ GEM
|
|
189
189
|
rubocop-rake (0.7.1)
|
190
190
|
lint_roller (~> 1.1)
|
191
191
|
rubocop (>= 1.72.1)
|
192
|
-
rubocop-rspec (3.
|
192
|
+
rubocop-rspec (3.6.0)
|
193
193
|
lint_roller (~> 1.1)
|
194
194
|
rubocop (~> 1.72, >= 1.72.1)
|
195
195
|
rubocop-rspec_rails (2.31.0)
|
@@ -207,7 +207,7 @@ GEM
|
|
207
207
|
rack-protection (= 4.1.1)
|
208
208
|
rack-session (>= 2.0.0, < 3)
|
209
209
|
tilt (~> 2.0)
|
210
|
-
strscan (3.1.
|
210
|
+
strscan (3.1.5)
|
211
211
|
syntax_tree (6.2.0)
|
212
212
|
prettier_print (>= 1.2.0)
|
213
213
|
syntax_tree-haml (4.0.3)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.5.
|
1
|
+
1.5.2
|
data/lib/code/object/boolean.rb
CHANGED
@@ -4,7 +4,8 @@ class Code
|
|
4
4
|
class Object
|
5
5
|
class Boolean < ::Code::Object
|
6
6
|
def initialize(*args, **_kargs, &_block)
|
7
|
-
self.raw =
|
7
|
+
self.raw =
|
8
|
+
(args.first.is_an?(Object) ? args.first.truthy? : !!args.first)
|
8
9
|
end
|
9
10
|
|
10
11
|
def call(**args)
|
data/lib/code/object/time.rb
CHANGED
@@ -71,6 +71,27 @@ class Code
|
|
71
71
|
when "seconds"
|
72
72
|
sig(args)
|
73
73
|
code_seconds
|
74
|
+
when "monday?"
|
75
|
+
sig(args)
|
76
|
+
code_monday?
|
77
|
+
when "tuesday?"
|
78
|
+
sig(args)
|
79
|
+
code_tuesday?
|
80
|
+
when "wednesday?"
|
81
|
+
sig(args)
|
82
|
+
code_wednesday?
|
83
|
+
when "thursday?"
|
84
|
+
sig(args)
|
85
|
+
code_thursday?
|
86
|
+
when "friday?"
|
87
|
+
sig(args)
|
88
|
+
code_friday?
|
89
|
+
when "saturday?"
|
90
|
+
sig(args)
|
91
|
+
code_saturday?
|
92
|
+
when "sunday?"
|
93
|
+
sig(args)
|
94
|
+
code_sunday?
|
74
95
|
when "format"
|
75
96
|
sig(args) { String }
|
76
97
|
code_format(code_value)
|
@@ -158,6 +179,34 @@ class Code
|
|
158
179
|
code_now.code_seconds
|
159
180
|
end
|
160
181
|
|
182
|
+
def self.code_monday?
|
183
|
+
code_week_day.code_one?
|
184
|
+
end
|
185
|
+
|
186
|
+
def self.code_tuesday?
|
187
|
+
code_week_day.code_two?
|
188
|
+
end
|
189
|
+
|
190
|
+
def self.code_wednesday?
|
191
|
+
code_week_day.code_three?
|
192
|
+
end
|
193
|
+
|
194
|
+
def self.code_thursday?
|
195
|
+
code_week_day.code_four?
|
196
|
+
end
|
197
|
+
|
198
|
+
def self.code_friday?
|
199
|
+
code_week_day.code_five?
|
200
|
+
end
|
201
|
+
|
202
|
+
def self.code_saturday?
|
203
|
+
code_week_day.code_six?
|
204
|
+
end
|
205
|
+
|
206
|
+
def self.code_sunday?
|
207
|
+
code_week_day.code_zero?
|
208
|
+
end
|
209
|
+
|
161
210
|
def self.code_format(format)
|
162
211
|
code_now.code_format(format)
|
163
212
|
end
|
@@ -228,6 +277,27 @@ class Code
|
|
228
277
|
when "seconds"
|
229
278
|
sig(args)
|
230
279
|
code_seconds
|
280
|
+
when "monday?"
|
281
|
+
sig(args)
|
282
|
+
code_monday?
|
283
|
+
when "tuesday?"
|
284
|
+
sig(args)
|
285
|
+
code_tuesday?
|
286
|
+
when "wednesday?"
|
287
|
+
sig(args)
|
288
|
+
code_wednesday?
|
289
|
+
when "thursday?"
|
290
|
+
sig(args)
|
291
|
+
code_thursday?
|
292
|
+
when "friday?"
|
293
|
+
sig(args)
|
294
|
+
code_friday?
|
295
|
+
when "saturday?"
|
296
|
+
sig(args)
|
297
|
+
code_saturday?
|
298
|
+
when "sunday?"
|
299
|
+
sig(args)
|
300
|
+
code_sunday?
|
231
301
|
when "format"
|
232
302
|
sig(args) { String }
|
233
303
|
code_format(code_value)
|
@@ -322,6 +392,34 @@ class Code
|
|
322
392
|
Integer.new(raw.sec)
|
323
393
|
end
|
324
394
|
|
395
|
+
def code_monday?
|
396
|
+
code_week_day.code_one?
|
397
|
+
end
|
398
|
+
|
399
|
+
def code_tuesday?
|
400
|
+
code_week_day.code_two?
|
401
|
+
end
|
402
|
+
|
403
|
+
def code_wednesday?
|
404
|
+
code_week_day.code_three?
|
405
|
+
end
|
406
|
+
|
407
|
+
def code_thursday?
|
408
|
+
code_week_day.code_four?
|
409
|
+
end
|
410
|
+
|
411
|
+
def code_friday?
|
412
|
+
code_week_day.code_five?
|
413
|
+
end
|
414
|
+
|
415
|
+
def code_saturday?
|
416
|
+
code_week_day.code_six?
|
417
|
+
end
|
418
|
+
|
419
|
+
def code_sunday?
|
420
|
+
code_week_day.code_zero?
|
421
|
+
end
|
422
|
+
|
325
423
|
def code_format(format)
|
326
424
|
code_format = format.to_code
|
327
425
|
|
data/spec/code_spec.rb
CHANGED
@@ -5,6 +5,20 @@ require "spec_helper"
|
|
5
5
|
RSpec.describe Code do
|
6
6
|
(
|
7
7
|
%w[
|
8
|
+
Time.monday?
|
9
|
+
Time.tuesday?
|
10
|
+
Time.wednesday?
|
11
|
+
Time.thursday?
|
12
|
+
Time.friday?
|
13
|
+
Time.saturday?
|
14
|
+
Time.sunday?
|
15
|
+
Time.now.monday?
|
16
|
+
Time.now.tuesday?
|
17
|
+
Time.now.wednesday?
|
18
|
+
Time.now.thursday?
|
19
|
+
Time.now.friday?
|
20
|
+
Time.now.saturday?
|
21
|
+
Time.now.sunday?
|
8
22
|
Time.now.second
|
9
23
|
Time.now.seconds
|
10
24
|
Time.now.minute
|