code-ruby 1.2.7 → 1.4.0
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 +79 -63
- data/TODO +219 -0
- data/VERSION +1 -1
- data/bin/code +3 -0
- data/lib/code/concerns/shared.rb +423 -0
- data/lib/code/concerns.rb +6 -0
- data/lib/code/object/code.rb +6 -0
- data/lib/code/object/dictionary.rb +6 -0
- data/lib/code/object/global.rb +6 -1
- data/lib/code/object/list.rb +17 -0
- data/lib/code/object/nothing.rb +8 -0
- data/lib/code/object/string.rb +23 -3
- data/lib/code/object.rb +8 -446
- data/lib/code/parser/call.rb +7 -2
- data/lib/code/parser/class.rb +1 -34
- data/lib/code/parser/function.rb +18 -2
- data/lib/code/parser/group.rb +14 -0
- data/lib/code/parser/if.rb +25 -4
- data/lib/code/parser/name.rb +11 -2
- data/lib/code/parser/while.rb +26 -1
- data/lib/code-ruby.rb +12 -0
- data/lib/code.rb +25 -18
- data/spec/code_spec.rb +2 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d61185fef6ddda1ee1ec0f449c77dad74283cf8ae4d127f36cd02bfc4aa59df
|
4
|
+
data.tar.gz: cb77def47d007482cc37adc20a74cf1cc2f651886292b8f55d2ee0821ef1856d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fef5749131d1c4f02af24ae234091b7c3b3edea2b31e68ea7dd7a9be2e2ebd05c6633db2c75e8f047c30e2446b325d8a4f1b20923d13c37883c5cf1afcf4d9e6
|
7
|
+
data.tar.gz: '09c79b2ef656bf3da9fb7033a7b228fd54b85b04693aba7fcda2292388a139550d4022794bfd4f16e02ca105b55b3a8c5dc6eba51d1fce04731851cc0eea4762'
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
code-ruby (1.
|
4
|
+
code-ruby (1.4.0)
|
5
5
|
activesupport
|
6
6
|
base64
|
7
7
|
bigdecimal
|
@@ -17,7 +17,7 @@ PATH
|
|
17
17
|
GEM
|
18
18
|
remote: https://rubygems.org/
|
19
19
|
specs:
|
20
|
-
activesupport (8.0.
|
20
|
+
activesupport (8.0.2)
|
21
21
|
base64
|
22
22
|
benchmark (>= 0.3)
|
23
23
|
bigdecimal
|
@@ -32,23 +32,23 @@ GEM
|
|
32
32
|
uri (>= 0.13.1)
|
33
33
|
addressable (2.8.7)
|
34
34
|
public_suffix (>= 2.0.2, < 7.0)
|
35
|
-
ast (2.4.
|
35
|
+
ast (2.4.3)
|
36
36
|
base64 (0.2.0)
|
37
37
|
benchmark (0.4.0)
|
38
|
-
bigdecimal (3.1.
|
38
|
+
bigdecimal (3.1.9)
|
39
39
|
bundler-audit (0.9.2)
|
40
40
|
bundler (>= 1.2.0, < 3)
|
41
41
|
thor (~> 1.0)
|
42
42
|
cmdparse (3.0.7)
|
43
|
-
concurrent-ruby (1.3.
|
44
|
-
connection_pool (2.
|
43
|
+
concurrent-ruby (1.3.5)
|
44
|
+
connection_pool (2.5.0)
|
45
45
|
crack (1.0.0)
|
46
46
|
bigdecimal
|
47
47
|
rexml
|
48
|
-
csv (3.3.
|
48
|
+
csv (3.3.3)
|
49
49
|
did-you-mean (0.1.1)
|
50
50
|
levenshtein (>= 0.2.0)
|
51
|
-
diff-lcs (1.
|
51
|
+
diff-lcs (1.6.1)
|
52
52
|
dorian (2.6.3)
|
53
53
|
csv
|
54
54
|
dorian-arguments
|
@@ -76,74 +76,78 @@ GEM
|
|
76
76
|
dorian-to_struct (2.0.2)
|
77
77
|
drb (2.2.1)
|
78
78
|
geom2d (0.4.1)
|
79
|
-
git (
|
79
|
+
git (3.0.0)
|
80
80
|
activesupport (>= 5.0)
|
81
81
|
addressable (~> 2.8)
|
82
|
-
process_executer (~> 1.
|
83
|
-
rchardet (~> 1.
|
82
|
+
process_executer (~> 1.3)
|
83
|
+
rchardet (~> 1.9)
|
84
84
|
haml (6.3.0)
|
85
85
|
temple (>= 0.8.2)
|
86
86
|
thor
|
87
87
|
tilt
|
88
88
|
hashdiff (1.1.2)
|
89
|
-
hexapdf (1.0
|
89
|
+
hexapdf (1.2.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
|
+
i18n (1.14.7)
|
94
95
|
concurrent-ruby (~> 1.0)
|
95
|
-
json (2.
|
96
|
+
json (2.10.2)
|
96
97
|
language-ruby (1.1.2)
|
97
98
|
dorian-arguments
|
98
99
|
zeitwerk
|
99
|
-
language_server-protocol (3.17.0.
|
100
|
+
language_server-protocol (3.17.0.4)
|
100
101
|
levenshtein (0.2.2)
|
101
|
-
libv8-node (
|
102
|
-
libv8-node (
|
103
|
-
libv8-node (
|
104
|
-
|
102
|
+
libv8-node (23.6.1.0)
|
103
|
+
libv8-node (23.6.1.0-arm64-darwin)
|
104
|
+
libv8-node (23.6.1.0-x86_64-linux)
|
105
|
+
lint_roller (1.1.0)
|
106
|
+
logger (1.7.0)
|
105
107
|
mini_portile2 (2.8.8)
|
106
|
-
mini_racer (0.
|
107
|
-
libv8-node (~>
|
108
|
-
minitest (5.25.
|
108
|
+
mini_racer (0.18.0)
|
109
|
+
libv8-node (~> 23.6.1.0)
|
110
|
+
minitest (5.25.5)
|
109
111
|
mustermann (3.0.3)
|
110
112
|
ruby2_keywords (~> 0.0.1)
|
111
113
|
net-http (0.6.0)
|
112
114
|
uri
|
113
|
-
nokogiri (1.18.
|
115
|
+
nokogiri (1.18.6)
|
114
116
|
mini_portile2 (~> 2.8.2)
|
115
117
|
racc (~> 1.4)
|
116
|
-
nokogiri (1.18.
|
118
|
+
nokogiri (1.18.6-arm64-darwin)
|
117
119
|
racc (~> 1.4)
|
118
|
-
nokogiri (1.18.
|
120
|
+
nokogiri (1.18.6-x86_64-linux-gnu)
|
119
121
|
racc (~> 1.4)
|
120
|
-
openssl (3.
|
122
|
+
openssl (3.3.0)
|
121
123
|
ostruct (0.6.1)
|
122
124
|
parallel (1.26.3)
|
123
|
-
parser (3.3.
|
125
|
+
parser (3.3.7.3)
|
124
126
|
ast (~> 2.4.1)
|
125
127
|
racc
|
126
128
|
prettier_print (1.2.1)
|
127
|
-
|
129
|
+
prism (1.4.0)
|
130
|
+
process_executer (1.3.0)
|
128
131
|
public_suffix (6.0.1)
|
129
132
|
racc (1.8.1)
|
130
|
-
rack (3.1.
|
133
|
+
rack (3.1.12)
|
131
134
|
rack-protection (4.1.1)
|
132
135
|
base64 (>= 0.1.0)
|
133
136
|
logger (>= 1.6.0)
|
134
137
|
rack (>= 3.0.0, < 4)
|
135
|
-
rack-session (2.
|
138
|
+
rack-session (2.1.0)
|
139
|
+
base64 (>= 0.1.0)
|
136
140
|
rack (>= 3.0.0)
|
137
141
|
rainbow (3.1.1)
|
138
142
|
rake (13.2.1)
|
139
|
-
rchardet (1.
|
140
|
-
regexp_parser (2.
|
141
|
-
rexml (3.4.
|
143
|
+
rchardet (1.9.0)
|
144
|
+
regexp_parser (2.10.0)
|
145
|
+
rexml (3.4.1)
|
142
146
|
rspec (3.13.0)
|
143
147
|
rspec-core (~> 3.13.0)
|
144
148
|
rspec-expectations (~> 3.13.0)
|
145
149
|
rspec-mocks (~> 3.13.0)
|
146
|
-
rspec-core (3.13.
|
150
|
+
rspec-core (3.13.3)
|
147
151
|
rspec-support (~> 3.13.0)
|
148
152
|
rspec-expectations (3.13.3)
|
149
153
|
diff-lcs (>= 1.2.0, < 2.0)
|
@@ -152,37 +156,46 @@ GEM
|
|
152
156
|
diff-lcs (>= 1.2.0, < 2.0)
|
153
157
|
rspec-support (~> 3.13.0)
|
154
158
|
rspec-support (3.13.2)
|
155
|
-
rubocop (1.
|
159
|
+
rubocop (1.75.1)
|
156
160
|
json (~> 2.3)
|
157
|
-
language_server-protocol (
|
161
|
+
language_server-protocol (~> 3.17.0.2)
|
162
|
+
lint_roller (~> 1.1.0)
|
158
163
|
parallel (~> 1.10)
|
159
164
|
parser (>= 3.3.0.2)
|
160
165
|
rainbow (>= 2.2.2, < 4.0)
|
161
166
|
regexp_parser (>= 2.9.3, < 3.0)
|
162
|
-
rubocop-ast (>= 1.
|
167
|
+
rubocop-ast (>= 1.43.0, < 2.0)
|
163
168
|
ruby-progressbar (~> 1.7)
|
164
169
|
unicode-display_width (>= 2.4.0, < 4.0)
|
165
|
-
rubocop-ast (1.
|
166
|
-
parser (>= 3.3.
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
rubocop (~> 1.
|
171
|
-
rubocop-
|
172
|
-
|
173
|
-
rubocop
|
174
|
-
rubocop-
|
170
|
+
rubocop-ast (1.43.0)
|
171
|
+
parser (>= 3.3.7.2)
|
172
|
+
prism (~> 1.4)
|
173
|
+
rubocop-capybara (2.22.1)
|
174
|
+
lint_roller (~> 1.1)
|
175
|
+
rubocop (~> 1.72, >= 1.72.1)
|
176
|
+
rubocop-factory_bot (2.27.1)
|
177
|
+
lint_roller (~> 1.1)
|
178
|
+
rubocop (~> 1.72, >= 1.72.1)
|
179
|
+
rubocop-performance (1.24.0)
|
180
|
+
lint_roller (~> 1.1)
|
181
|
+
rubocop (>= 1.72.1, < 2.0)
|
182
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
183
|
+
rubocop-rails (2.30.3)
|
175
184
|
activesupport (>= 4.2.0)
|
185
|
+
lint_roller (~> 1.1)
|
176
186
|
rack (>= 1.1)
|
177
|
-
rubocop (>= 1.
|
178
|
-
rubocop-ast (>= 1.
|
179
|
-
rubocop-rake (0.
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
rubocop (~> 1.
|
185
|
-
|
187
|
+
rubocop (>= 1.72.1, < 2.0)
|
188
|
+
rubocop-ast (>= 1.38.0, < 2.0)
|
189
|
+
rubocop-rake (0.7.1)
|
190
|
+
lint_roller (~> 1.1)
|
191
|
+
rubocop (>= 1.72.1)
|
192
|
+
rubocop-rspec (3.5.0)
|
193
|
+
lint_roller (~> 1.1)
|
194
|
+
rubocop (~> 1.72, >= 1.72.1)
|
195
|
+
rubocop-rspec_rails (2.31.0)
|
196
|
+
lint_roller (~> 1.1)
|
197
|
+
rubocop (~> 1.72, >= 1.72.1)
|
198
|
+
rubocop-rspec (~> 3.5)
|
186
199
|
ruby-prof (1.7.1)
|
187
200
|
ruby-progressbar (1.13.0)
|
188
201
|
ruby2_keywords (0.0.5)
|
@@ -194,6 +207,7 @@ GEM
|
|
194
207
|
rack-protection (= 4.1.1)
|
195
208
|
rack-session (>= 2.0.0, < 3)
|
196
209
|
tilt (~> 2.0)
|
210
|
+
strscan (3.1.2)
|
197
211
|
syntax_tree (6.2.0)
|
198
212
|
prettier_print (>= 1.2.0)
|
199
213
|
syntax_tree-haml (4.0.3)
|
@@ -204,23 +218,25 @@ GEM
|
|
204
218
|
prettier_print
|
205
219
|
syntax_tree (>= 2.0.1)
|
206
220
|
temple (0.10.3)
|
207
|
-
terminal-table (
|
208
|
-
unicode-display_width (>= 1.1.1, <
|
221
|
+
terminal-table (4.0.0)
|
222
|
+
unicode-display_width (>= 1.1.1, < 4)
|
209
223
|
thor (1.3.2)
|
210
|
-
tilt (2.
|
224
|
+
tilt (2.6.0)
|
211
225
|
tzinfo (2.0.6)
|
212
226
|
concurrent-ruby (~> 1.0)
|
213
|
-
unicode-display_width (
|
214
|
-
|
227
|
+
unicode-display_width (3.1.4)
|
228
|
+
unicode-emoji (~> 4.0, >= 4.0.4)
|
229
|
+
unicode-emoji (4.0.4)
|
230
|
+
uri (1.0.3)
|
215
231
|
w_syntax_tree-erb (0.12.0)
|
216
232
|
prettier_print (~> 1.2, >= 1.2.0)
|
217
233
|
syntax_tree (~> 6.1, >= 6.1.1)
|
218
|
-
webmock (3.
|
234
|
+
webmock (3.25.1)
|
219
235
|
addressable (>= 2.8.0)
|
220
236
|
crack (>= 0.3.2)
|
221
237
|
hashdiff (>= 0.4.0, < 2.0.0)
|
222
238
|
yaml (0.4.0)
|
223
|
-
zeitwerk (2.7.
|
239
|
+
zeitwerk (2.7.2)
|
224
240
|
|
225
241
|
PLATFORMS
|
226
242
|
arm64-darwin-23
|
data/TODO
ADDED
@@ -0,0 +1,219 @@
|
|
1
|
+
to_query
|
2
|
+
to_h
|
3
|
+
include?
|
4
|
+
&
|
5
|
+
shelljoin
|
6
|
+
*
|
7
|
+
+
|
8
|
+
blank?
|
9
|
+
-
|
10
|
+
present?
|
11
|
+
from
|
12
|
+
extract!
|
13
|
+
at
|
14
|
+
fetch
|
15
|
+
union
|
16
|
+
difference
|
17
|
+
intersection
|
18
|
+
intersect?
|
19
|
+
push
|
20
|
+
append
|
21
|
+
pop
|
22
|
+
shift
|
23
|
+
unshift
|
24
|
+
each_index
|
25
|
+
join
|
26
|
+
rotate
|
27
|
+
rotate!
|
28
|
+
sort!
|
29
|
+
sort_by!
|
30
|
+
collect!
|
31
|
+
map!
|
32
|
+
select!
|
33
|
+
filter!
|
34
|
+
keep_if
|
35
|
+
values_at
|
36
|
+
sort
|
37
|
+
delete_if
|
38
|
+
reject!
|
39
|
+
delete_at
|
40
|
+
count
|
41
|
+
fill
|
42
|
+
find_index
|
43
|
+
rassoc
|
44
|
+
select
|
45
|
+
filter
|
46
|
+
uniq!
|
47
|
+
reject
|
48
|
+
collect
|
49
|
+
map
|
50
|
+
compact!
|
51
|
+
assoc
|
52
|
+
flatten!
|
53
|
+
permutation
|
54
|
+
transpose
|
55
|
+
flatten
|
56
|
+
repeated_combination
|
57
|
+
product
|
58
|
+
combination
|
59
|
+
repeated_permutation
|
60
|
+
any?
|
61
|
+
all?
|
62
|
+
minmax
|
63
|
+
bsearch_index
|
64
|
+
none?
|
65
|
+
one?
|
66
|
+
bsearch
|
67
|
+
reverse_each
|
68
|
+
deconstruct
|
69
|
+
|
|
70
|
+
first
|
71
|
+
zip
|
72
|
+
take
|
73
|
+
take_while
|
74
|
+
drop
|
75
|
+
drop_while
|
76
|
+
cycle
|
77
|
+
shuffle!
|
78
|
+
shuffle
|
79
|
+
sample
|
80
|
+
<=>
|
81
|
+
<<
|
82
|
+
sum
|
83
|
+
uniq
|
84
|
+
compact
|
85
|
+
==
|
86
|
+
second
|
87
|
+
pack
|
88
|
+
to
|
89
|
+
[]
|
90
|
+
[]=
|
91
|
+
empty?
|
92
|
+
eql?
|
93
|
+
insert
|
94
|
+
compact_blank!
|
95
|
+
index
|
96
|
+
rindex
|
97
|
+
replace
|
98
|
+
clear
|
99
|
+
max
|
100
|
+
min
|
101
|
+
hash
|
102
|
+
inspect
|
103
|
+
including
|
104
|
+
excluding
|
105
|
+
length
|
106
|
+
size
|
107
|
+
third
|
108
|
+
without
|
109
|
+
each
|
110
|
+
fourth
|
111
|
+
fifth
|
112
|
+
forty_two
|
113
|
+
third_to_last
|
114
|
+
second_to_last
|
115
|
+
extract_options!
|
116
|
+
in_groups_of
|
117
|
+
reverse
|
118
|
+
to_ary
|
119
|
+
concat
|
120
|
+
prepend
|
121
|
+
reverse!
|
122
|
+
in_groups
|
123
|
+
to_a
|
124
|
+
to_s
|
125
|
+
split
|
126
|
+
inquiry
|
127
|
+
to_sentence
|
128
|
+
as_json
|
129
|
+
pretty_print
|
130
|
+
delete
|
131
|
+
to_formatted_s
|
132
|
+
pretty_print_cycle
|
133
|
+
to_xml
|
134
|
+
to_fs
|
135
|
+
slice
|
136
|
+
slice!
|
137
|
+
dig
|
138
|
+
to_json
|
139
|
+
chunk
|
140
|
+
slice_before
|
141
|
+
slice_after
|
142
|
+
slice_when
|
143
|
+
chunk_while
|
144
|
+
maximum
|
145
|
+
chain
|
146
|
+
to_set
|
147
|
+
lazy
|
148
|
+
many?
|
149
|
+
sole
|
150
|
+
exclude?
|
151
|
+
minimum
|
152
|
+
pick
|
153
|
+
index_by
|
154
|
+
index_with
|
155
|
+
pluck
|
156
|
+
in_order_of
|
157
|
+
compact_blank
|
158
|
+
find
|
159
|
+
entries
|
160
|
+
sort_by
|
161
|
+
grep
|
162
|
+
grep_v
|
163
|
+
detect
|
164
|
+
find_all
|
165
|
+
filter_map
|
166
|
+
flat_map
|
167
|
+
collect_concat
|
168
|
+
inject
|
169
|
+
reduce
|
170
|
+
partition
|
171
|
+
group_by
|
172
|
+
tally
|
173
|
+
min_by
|
174
|
+
max_by
|
175
|
+
minmax_by
|
176
|
+
member?
|
177
|
+
each_with_index
|
178
|
+
each_entry
|
179
|
+
each_slice
|
180
|
+
each_cons
|
181
|
+
each_with_object
|
182
|
+
to_yaml
|
183
|
+
duplicable?
|
184
|
+
in?
|
185
|
+
with
|
186
|
+
presence_in
|
187
|
+
presence
|
188
|
+
acts_like?
|
189
|
+
html_safe?
|
190
|
+
with_options
|
191
|
+
try!
|
192
|
+
try
|
193
|
+
pretty_print_inspect
|
194
|
+
singleton_class
|
195
|
+
dup
|
196
|
+
itself
|
197
|
+
kind_of?
|
198
|
+
is_a?
|
199
|
+
display
|
200
|
+
class_eval
|
201
|
+
extend
|
202
|
+
clone
|
203
|
+
frozen?
|
204
|
+
then
|
205
|
+
tap
|
206
|
+
yield_self
|
207
|
+
===
|
208
|
+
class
|
209
|
+
!~
|
210
|
+
nil?
|
211
|
+
respond_to?
|
212
|
+
freeze
|
213
|
+
object_id
|
214
|
+
to_enum
|
215
|
+
enum_for
|
216
|
+
pretty_inspect
|
217
|
+
equal?
|
218
|
+
!
|
219
|
+
!=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.4.0
|
data/bin/code
CHANGED
@@ -43,6 +43,8 @@ require "ruby-prof" if profile
|
|
43
43
|
|
44
44
|
RubyProf.start if profile
|
45
45
|
|
46
|
+
input = 'loop { print("> ") puts(evaluate(read)) }' if input.blank?
|
47
|
+
|
46
48
|
if parsed.options.parse
|
47
49
|
pp Code::Parser.parse(input).to_raw
|
48
50
|
else
|
@@ -51,6 +53,7 @@ else
|
|
51
53
|
input,
|
52
54
|
output: $stdout,
|
53
55
|
error: $stderr,
|
56
|
+
input: $stdin,
|
54
57
|
timeout: parsed.options.timeout
|
55
58
|
)
|
56
59
|
)
|