code-ruby 3.1.2 → 4.0.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/VERSION +1 -1
- data/bin/code +100 -20
- data/lib/code/concerns/shared.rb +335 -15
- data/lib/code/format.rb +33 -15
- data/lib/code/network.rb +82 -0
- data/lib/code/node/call.rb +80 -2
- data/lib/code/node/call_argument.rb +14 -0
- data/lib/code/node/code.rb +4 -3
- data/lib/code/node/function_parameter.rb +7 -4
- data/lib/code/node/list.rb +32 -2
- data/lib/code/node/square_bracket.rb +4 -2
- data/lib/code/object/base_64.rb +132 -6
- data/lib/code/object/boolean.rb +56 -0
- data/lib/code/object/class.rb +143 -2
- data/lib/code/object/code.rb +108 -7
- data/lib/code/object/context.rb +59 -1
- data/lib/code/object/cryptography.rb +69 -0
- data/lib/code/object/date.rb +13800 -462
- data/lib/code/object/decimal.rb +1098 -0
- data/lib/code/object/dictionary.rb +1861 -11
- data/lib/code/object/duration.rb +24 -0
- data/lib/code/object/function.rb +289 -27
- data/lib/code/object/global.rb +447 -1
- data/lib/code/object/html.rb +181 -7
- data/lib/code/object/http.rb +253 -17
- data/lib/code/object/ics.rb +76 -13
- data/lib/code/object/identifier_list.rb +30 -10
- data/lib/code/object/integer.rb +1265 -2
- data/lib/code/object/json.rb +80 -1
- data/lib/code/object/list.rb +3371 -10
- data/lib/code/object/nothing.rb +53 -0
- data/lib/code/object/number.rb +120 -0
- data/lib/code/object/parameter.rb +149 -0
- data/lib/code/object/range.rb +530 -14
- data/lib/code/object/smtp.rb +103 -12
- data/lib/code/object/string.rb +968 -3
- data/lib/code/object/super.rb +11 -1
- data/lib/code/object/time.rb +13932 -498
- data/lib/code/object/url.rb +67 -0
- data/lib/code/object.rb +582 -0
- data/lib/code/parser.rb +194 -55
- data/lib/code-ruby.rb +3 -0
- data/lib/code.rb +30 -3
- metadata +135 -84
- data/.github/dependabot.yml +0 -15
- data/.github/workflows/ci.yml +0 -38
- data/.gitignore +0 -30
- data/.node-version +0 -1
- data/.npm-version +0 -1
- data/.prettierignore +0 -2
- data/.rspec +0 -1
- data/.rubocop.yml +0 -140
- data/.ruby-version +0 -1
- data/.tool-versions +0 -3
- data/AGENTS.md +0 -43
- data/Gemfile +0 -22
- data/Gemfile.lock +0 -292
- data/Rakefile +0 -5
- data/bin/bundle +0 -123
- data/bin/bundle-audit +0 -31
- data/bin/bundler-audit +0 -31
- data/bin/dorian +0 -31
- data/bin/rspec +0 -31
- data/bin/rubocop +0 -31
- data/bin/test +0 -5
- data/code-ruby.gemspec +0 -34
- data/docs/precedence.txt +0 -36
- data/package-lock.json +0 -14
- data/package.json +0 -7
- data/spec/bin/code_spec.rb +0 -48
- data/spec/code/format_spec.rb +0 -153
- data/spec/code/node/call_spec.rb +0 -11
- data/spec/code/object/boolean_spec.rb +0 -18
- data/spec/code/object/cryptography_spec.rb +0 -25
- data/spec/code/object/decimal_spec.rb +0 -50
- data/spec/code/object/dictionary_spec.rb +0 -98
- data/spec/code/object/function_spec.rb +0 -268
- data/spec/code/object/http_spec.rb +0 -33
- data/spec/code/object/ics_spec.rb +0 -50
- data/spec/code/object/integer_spec.rb +0 -42
- data/spec/code/object/list_spec.rb +0 -22
- data/spec/code/object/nothing_spec.rb +0 -14
- data/spec/code/object/range_spec.rb +0 -23
- data/spec/code/object/string_spec.rb +0 -26
- data/spec/code/parser/boolean_spec.rb +0 -11
- data/spec/code/parser/chained_call_spec.rb +0 -16
- data/spec/code/parser/dictionary_spec.rb +0 -18
- data/spec/code/parser/function_spec.rb +0 -16
- data/spec/code/parser/group_spec.rb +0 -11
- data/spec/code/parser/if_modifier_spec.rb +0 -18
- data/spec/code/parser/list_spec.rb +0 -17
- data/spec/code/parser/number_spec.rb +0 -11
- data/spec/code/parser/string_spec.rb +0 -20
- data/spec/code/parser_spec.rb +0 -52
- data/spec/code/type_spec.rb +0 -21
- data/spec/code_spec.rb +0 -717
- data/spec/spec_helper.rb +0 -21
- data/spec/zeitwerk/loader_spec.rb +0 -7
|
@@ -3,6 +3,1529 @@
|
|
|
3
3
|
class Code
|
|
4
4
|
class Object
|
|
5
5
|
class Dictionary < ::Code::Object
|
|
6
|
+
CLASS_DOCUMENTATION = {
|
|
7
|
+
name: "Dictionary",
|
|
8
|
+
description:
|
|
9
|
+
"stores keyed values and provides lookup, merge, and enumerable operations.",
|
|
10
|
+
examples: [
|
|
11
|
+
"{ a: 1 }",
|
|
12
|
+
"Dictionary.from_entries([[:a, 1]])",
|
|
13
|
+
"{ a: 1 }.fetch(:a)"
|
|
14
|
+
]
|
|
15
|
+
}.freeze
|
|
16
|
+
CLASS_FUNCTIONS = {
|
|
17
|
+
"entries" => {
|
|
18
|
+
name: "entries",
|
|
19
|
+
description: "converts a dictionary to a list of key-value entries.",
|
|
20
|
+
examples: [
|
|
21
|
+
"Dictionary.entries({ a: 1 })",
|
|
22
|
+
"Dictionary.entries({ a: 1, b: 2 })",
|
|
23
|
+
"Dictionary.entries({})"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"from_entries" => {
|
|
27
|
+
name: "from_entries",
|
|
28
|
+
description: "builds a dictionary from key-value entries.",
|
|
29
|
+
examples: [
|
|
30
|
+
"Dictionary.from_entries([[:a, 1]])",
|
|
31
|
+
"Dictionary.from_entries([[:a, 1], [:b, 2]])",
|
|
32
|
+
"Dictionary.from_entries([])"
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
"assign" => {
|
|
36
|
+
name: "assign",
|
|
37
|
+
description: "merges one or more dictionaries into a new dictionary.",
|
|
38
|
+
examples: [
|
|
39
|
+
"Dictionary.assign({ a: 1 })",
|
|
40
|
+
"Dictionary.assign({ a: 1 }, { b: 2 })",
|
|
41
|
+
"Dictionary.assign({ a: 1 }, { a: 2 })"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
"has_own?" => {
|
|
45
|
+
name: "has_own?",
|
|
46
|
+
description: "returns whether a dictionary contains a key.",
|
|
47
|
+
examples: [
|
|
48
|
+
"Dictionary.has_own?({ a: 1 }, :a)",
|
|
49
|
+
"Dictionary.has_own?({ a: 1 }, :b)",
|
|
50
|
+
"Dictionary.has_own?({}, :a)"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
}.freeze
|
|
54
|
+
INSTANCE_FUNCTIONS = {
|
|
55
|
+
"[]" => {
|
|
56
|
+
name: "[]",
|
|
57
|
+
description: "returns the value for a key, otherwise nothing.",
|
|
58
|
+
examples: ["{ a: 1 }[:a]", "{ a: 1 }[:b]", "{ a: 1, b: 2 }[:b]"]
|
|
59
|
+
},
|
|
60
|
+
"at" => {
|
|
61
|
+
name: "at",
|
|
62
|
+
description: "alias for get.",
|
|
63
|
+
examples: [
|
|
64
|
+
"{ a: 1 }.at(:a)",
|
|
65
|
+
"{ a: 1 }.at(:b)",
|
|
66
|
+
"{ a: 1, b: 2 }.at(:b)"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"get" => {
|
|
70
|
+
name: "get",
|
|
71
|
+
description: "returns the value for a key, otherwise nothing.",
|
|
72
|
+
examples: [
|
|
73
|
+
"{ a: 1 }.get(:a)",
|
|
74
|
+
"{ a: 1 }.get(:b)",
|
|
75
|
+
"{ a: 1, b: 2 }.get(:b)"
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
"any?" => {
|
|
79
|
+
name: "any?",
|
|
80
|
+
description:
|
|
81
|
+
"returns whether any entry exists, has a class value, or matches a function.",
|
|
82
|
+
examples: [
|
|
83
|
+
"{ a: 1 }.any?",
|
|
84
|
+
"{}.any?",
|
|
85
|
+
"{ a: 1 }.any?((key, value) => { value == 1 })"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
"clear" => {
|
|
89
|
+
name: "clear",
|
|
90
|
+
description:
|
|
91
|
+
"removes every entry from the dictionary and returns it.",
|
|
92
|
+
examples: ["{ a: 1 }.clear", "{ a: 1, b: 2 }.clear", "{}.clear"]
|
|
93
|
+
},
|
|
94
|
+
"compact" => {
|
|
95
|
+
name: "compact",
|
|
96
|
+
description:
|
|
97
|
+
"returns a dictionary without nothing values or matching values.",
|
|
98
|
+
examples: [
|
|
99
|
+
"{ a: 1, b: nothing }.compact",
|
|
100
|
+
"{ a: 1, b: :x }.compact(String)",
|
|
101
|
+
"{ a: 1, b: 2 }.compact((value) => { value > 1 })"
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
"compact!" => {
|
|
105
|
+
name: "compact!",
|
|
106
|
+
description:
|
|
107
|
+
"removes nothing values or matching values from the dictionary.",
|
|
108
|
+
examples: [
|
|
109
|
+
"{ a: 1, b: nothing }.compact!",
|
|
110
|
+
"{ a: 1, b: :x }.compact!(String)",
|
|
111
|
+
"{ a: 1, b: 2 }.compact!((value) => { value > 1 })"
|
|
112
|
+
]
|
|
113
|
+
},
|
|
114
|
+
"delete" => {
|
|
115
|
+
name: "delete",
|
|
116
|
+
description: "removes entries by key and returns their values.",
|
|
117
|
+
examples: [
|
|
118
|
+
"{ a: 1 }.delete(:a)",
|
|
119
|
+
"{ a: 1 }.delete(:b)",
|
|
120
|
+
"{ a: 1, b: 2 }.delete(:a, :b)"
|
|
121
|
+
]
|
|
122
|
+
},
|
|
123
|
+
"delete_if" => {
|
|
124
|
+
name: "delete_if",
|
|
125
|
+
description: "removes entries when a function returns truthy.",
|
|
126
|
+
examples: [
|
|
127
|
+
"{ a: 1, b: 2 }.delete_if((key, value) => { value > 1 })",
|
|
128
|
+
"{ a: 1 }.delete_if((key) => { key == :a })",
|
|
129
|
+
"{ a: 1, b: :x }.delete_if(String)"
|
|
130
|
+
]
|
|
131
|
+
},
|
|
132
|
+
"delete_unless" => {
|
|
133
|
+
name: "delete_unless",
|
|
134
|
+
description: "removes entries unless a function returns truthy.",
|
|
135
|
+
examples: [
|
|
136
|
+
"{ a: 1, b: 2 }.delete_unless((key, value) => { value > 1 })",
|
|
137
|
+
"{ a: 1 }.delete_unless((key) => { key == :a })",
|
|
138
|
+
"{ a: 1, b: :x }.delete_unless(String)"
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"dig" => {
|
|
142
|
+
name: "dig",
|
|
143
|
+
description: "returns a nested value by following keys.",
|
|
144
|
+
examples: [
|
|
145
|
+
"{ a: { b: 1 } }.dig(:a, :b)",
|
|
146
|
+
"{ a: [1] }.dig(:a, 0)",
|
|
147
|
+
"{ a: 1 }.dig(:missing)"
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
"each" => {
|
|
151
|
+
name: "each",
|
|
152
|
+
description:
|
|
153
|
+
"calls a function for each key-value pair and returns the dictionary.",
|
|
154
|
+
examples: [
|
|
155
|
+
"{ a: 1 }.each((key, value) => { value })",
|
|
156
|
+
"{ a: 1 }.each((key, value, index) => { index })",
|
|
157
|
+
"{ a: 1 }.each((key, value, index, dictionary) => { dictionary })"
|
|
158
|
+
]
|
|
159
|
+
},
|
|
160
|
+
"each_key" => {
|
|
161
|
+
name: "each_key",
|
|
162
|
+
description:
|
|
163
|
+
"calls a function for each key and returns the dictionary.",
|
|
164
|
+
examples: [
|
|
165
|
+
"{ a: 1 }.each_key((key) => { key })",
|
|
166
|
+
"{ a: 1, b: 2 }.each_key((key, index) => { index })",
|
|
167
|
+
"{}.each_key((key) => { key })"
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
"each_value" => {
|
|
171
|
+
name: "each_value",
|
|
172
|
+
description:
|
|
173
|
+
"calls a function for each value and returns the dictionary.",
|
|
174
|
+
examples: [
|
|
175
|
+
"{ a: 1 }.each_value((value) => { value })",
|
|
176
|
+
"{ a: 1, b: 2 }.each_value((value, index) => { index })",
|
|
177
|
+
"{}.each_value((value) => { value })"
|
|
178
|
+
]
|
|
179
|
+
},
|
|
180
|
+
"each_pair" => {
|
|
181
|
+
name: "each_pair",
|
|
182
|
+
description:
|
|
183
|
+
"calls a function for each key-value pair and returns the dictionary.",
|
|
184
|
+
examples: [
|
|
185
|
+
"{ a: 1 }.each_pair((key, value) => { value })",
|
|
186
|
+
"{ a: 1, b: 2 }.each_pair((key, value, index) => { index })",
|
|
187
|
+
"{}.each_pair((key, value) => { value })"
|
|
188
|
+
]
|
|
189
|
+
},
|
|
190
|
+
"empty?" => {
|
|
191
|
+
name: "empty?",
|
|
192
|
+
description: "returns whether the dictionary has no entries.",
|
|
193
|
+
examples: ["{}.empty?", "{ a: 1 }.empty?", "{ a: nothing }.empty?"]
|
|
194
|
+
},
|
|
195
|
+
"except" => {
|
|
196
|
+
name: "except",
|
|
197
|
+
description: "returns a dictionary without the given keys.",
|
|
198
|
+
examples: [
|
|
199
|
+
"{ a: 1, b: 2 }.except(:a)",
|
|
200
|
+
"{ a: 1, b: 2 }.except(:a, :b)",
|
|
201
|
+
"{ a: 1 }.except(:missing)"
|
|
202
|
+
]
|
|
203
|
+
},
|
|
204
|
+
"fetch" => {
|
|
205
|
+
name: "fetch",
|
|
206
|
+
description: "returns values by key, default function, or nothing.",
|
|
207
|
+
examples: [
|
|
208
|
+
"{ a: 1 }.fetch(:a)",
|
|
209
|
+
"{ a: 1 }.fetch(:b, () => { 2 })",
|
|
210
|
+
"{ a: 1 }.fetch(:missing)"
|
|
211
|
+
]
|
|
212
|
+
},
|
|
213
|
+
"fetch_values" => {
|
|
214
|
+
name: "fetch_values",
|
|
215
|
+
description: "returns values for the given keys.",
|
|
216
|
+
examples: [
|
|
217
|
+
"{ a: 1, b: 2 }.fetch_values(:a)",
|
|
218
|
+
"{ a: 1, b: 2 }.fetch_values(:a, :b)",
|
|
219
|
+
"{ a: 1, b: 2 }.fetch_values(:b)"
|
|
220
|
+
]
|
|
221
|
+
},
|
|
222
|
+
"flatten" => {
|
|
223
|
+
name: "flatten",
|
|
224
|
+
description:
|
|
225
|
+
"returns a flattened list of dictionary keys and values.",
|
|
226
|
+
examples: [
|
|
227
|
+
"{ a: 1 }.flatten",
|
|
228
|
+
"{ a: { b: 1 } }.flatten",
|
|
229
|
+
"{ a: 1 }.flatten(1)"
|
|
230
|
+
]
|
|
231
|
+
},
|
|
232
|
+
"has_key?" => {
|
|
233
|
+
name: "has_key?",
|
|
234
|
+
description: "returns whether the dictionary contains a key.",
|
|
235
|
+
examples: [
|
|
236
|
+
"{ a: 1 }.has_key?(:a)",
|
|
237
|
+
"{ a: 1 }.has_key?(:b)",
|
|
238
|
+
"{}.has_key?(:a)"
|
|
239
|
+
]
|
|
240
|
+
},
|
|
241
|
+
"key?" => {
|
|
242
|
+
name: "key?",
|
|
243
|
+
description: "alias for has_key?.",
|
|
244
|
+
examples: ["{ a: 1 }.key?(:a)", "{ a: 1 }.key?(:b)", "{}.key?(:a)"]
|
|
245
|
+
},
|
|
246
|
+
"include?" => {
|
|
247
|
+
name: "include?",
|
|
248
|
+
description: "alias for has_key?.",
|
|
249
|
+
examples: [
|
|
250
|
+
"{ a: 1 }.include?(:a)",
|
|
251
|
+
"{ a: 1 }.include?(:b)",
|
|
252
|
+
"{}.include?(:a)"
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
"member?" => {
|
|
256
|
+
name: "member?",
|
|
257
|
+
description: "alias for has_key?.",
|
|
258
|
+
examples: [
|
|
259
|
+
"{ a: 1 }.member?(:a)",
|
|
260
|
+
"{ a: 1 }.member?(:b)",
|
|
261
|
+
"{}.member?(:a)"
|
|
262
|
+
]
|
|
263
|
+
},
|
|
264
|
+
"has_own?" => {
|
|
265
|
+
name: "has_own?",
|
|
266
|
+
description: "returns whether the dictionary contains a key.",
|
|
267
|
+
examples: [
|
|
268
|
+
"{ a: 1 }.has_own?(:a)",
|
|
269
|
+
"{ a: 1 }.has_own?(:b)",
|
|
270
|
+
"{}.has_own?(:a)"
|
|
271
|
+
]
|
|
272
|
+
},
|
|
273
|
+
"has_value?" => {
|
|
274
|
+
name: "has_value?",
|
|
275
|
+
description: "returns whether the dictionary has a value.",
|
|
276
|
+
examples: [
|
|
277
|
+
"{ a: 1 }.has_value?(1)",
|
|
278
|
+
"{ a: 1 }.has_value?(2)",
|
|
279
|
+
"{}.has_value?(1)"
|
|
280
|
+
]
|
|
281
|
+
},
|
|
282
|
+
"value?" => {
|
|
283
|
+
name: "value?",
|
|
284
|
+
description: "alias for has_value?.",
|
|
285
|
+
examples: ["{ a: 1 }.value?(1)", "{ a: 1 }.value?(2)", "{}.value?(1)"]
|
|
286
|
+
},
|
|
287
|
+
"invert" => {
|
|
288
|
+
name: "invert",
|
|
289
|
+
description: "returns a dictionary with keys and values swapped.",
|
|
290
|
+
examples: ["{ a: 1 }.invert", "{ a: 1, b: 2 }.invert", "{}.invert"]
|
|
291
|
+
},
|
|
292
|
+
"keep_if" => {
|
|
293
|
+
name: "keep_if",
|
|
294
|
+
description: "keeps entries when a function returns truthy.",
|
|
295
|
+
examples: [
|
|
296
|
+
"{ a: 1, b: 2 }.keep_if((key, value) => { value > 1 })",
|
|
297
|
+
"{ a: 1 }.keep_if((key) => { key == :a })",
|
|
298
|
+
"{ a: 1, b: :x }.keep_if(String)"
|
|
299
|
+
]
|
|
300
|
+
},
|
|
301
|
+
"keep_unless" => {
|
|
302
|
+
name: "keep_unless",
|
|
303
|
+
description: "keeps entries unless a function returns truthy.",
|
|
304
|
+
examples: [
|
|
305
|
+
"{ a: 1, b: 2 }.keep_unless((key, value) => { value > 1 })",
|
|
306
|
+
"{ a: 1 }.keep_unless((key) => { key == :a })",
|
|
307
|
+
"{ a: 1, b: :x }.keep_unless(String)"
|
|
308
|
+
]
|
|
309
|
+
},
|
|
310
|
+
"key" => {
|
|
311
|
+
name: "key",
|
|
312
|
+
description:
|
|
313
|
+
"returns the first key for a value, or a fallback result.",
|
|
314
|
+
examples: [
|
|
315
|
+
"{ a: 1 }.key(1)",
|
|
316
|
+
"{ a: 1, b: 2 }.key(2)",
|
|
317
|
+
"{ a: 1, b: 2 }.key(0, (value) => { :missing })"
|
|
318
|
+
]
|
|
319
|
+
},
|
|
320
|
+
"keys" => {
|
|
321
|
+
name: "keys",
|
|
322
|
+
description: "returns the dictionary keys.",
|
|
323
|
+
examples: ["{ a: 1 }.keys", "{ a: 1, b: 2 }.keys", "{}.keys"]
|
|
324
|
+
},
|
|
325
|
+
"map" => {
|
|
326
|
+
name: "map",
|
|
327
|
+
description: "returns a list by calling a function for each entry.",
|
|
328
|
+
examples: [
|
|
329
|
+
"{ a: 1 }.map((key, value) => { key })",
|
|
330
|
+
"{ a: 1 }.map((key, value) => { value })",
|
|
331
|
+
"{ a: 1 }.map((key, value, index) => { index })"
|
|
332
|
+
]
|
|
333
|
+
},
|
|
334
|
+
"merge" => {
|
|
335
|
+
name: "merge",
|
|
336
|
+
description: "returns a dictionary merged with other dictionaries.",
|
|
337
|
+
examples: [
|
|
338
|
+
"{ a: 1 }.merge({ b: 2 })",
|
|
339
|
+
"{ a: 1 }.merge({ a: 2 })",
|
|
340
|
+
"{ a: 1 }.merge({ a: 2 }, (key, left, right) => { left })"
|
|
341
|
+
]
|
|
342
|
+
},
|
|
343
|
+
"merge!" => {
|
|
344
|
+
name: "merge!",
|
|
345
|
+
description: "merges other dictionaries into the receiver.",
|
|
346
|
+
examples: [
|
|
347
|
+
"{ a: 1 }.merge!({ b: 2 })",
|
|
348
|
+
"{ a: 1 }.merge!({ a: 2 })",
|
|
349
|
+
"{ a: 1 }.merge!({ a: 2 }, (key, left, right) => { left })"
|
|
350
|
+
]
|
|
351
|
+
},
|
|
352
|
+
"update" => {
|
|
353
|
+
name: "update",
|
|
354
|
+
description: "alias for merge!.",
|
|
355
|
+
examples: [
|
|
356
|
+
"{ a: 1 }.update({ b: 2 })",
|
|
357
|
+
"{ a: 1 }.update({ a: 2 })",
|
|
358
|
+
"{ a: 1 }.update({ a: 2 }, (key, left, right) => { left })"
|
|
359
|
+
]
|
|
360
|
+
},
|
|
361
|
+
"replace" => {
|
|
362
|
+
name: "replace",
|
|
363
|
+
description:
|
|
364
|
+
"replaces the dictionary contents with another dictionary.",
|
|
365
|
+
examples: [
|
|
366
|
+
"{ a: 1 }.replace({ b: 2 })",
|
|
367
|
+
"{ a: 1, b: 2 }.replace({})",
|
|
368
|
+
"{}.replace({ a: 1 })"
|
|
369
|
+
]
|
|
370
|
+
},
|
|
371
|
+
"store" => {
|
|
372
|
+
name: "store",
|
|
373
|
+
description: "sets a key to a value and returns the value.",
|
|
374
|
+
examples: [
|
|
375
|
+
"{ a: 1 }.store(:b, 2)",
|
|
376
|
+
"{}.store(:a, 1)",
|
|
377
|
+
"{ a: 1 }.store(:a, 2)"
|
|
378
|
+
]
|
|
379
|
+
},
|
|
380
|
+
"shift" => {
|
|
381
|
+
name: "shift",
|
|
382
|
+
description: "removes and returns the first key-value entry.",
|
|
383
|
+
examples: ["{ a: 1 }.shift", "{ a: 1, b: 2 }.shift", "{}.shift"]
|
|
384
|
+
},
|
|
385
|
+
"reject" => {
|
|
386
|
+
name: "reject",
|
|
387
|
+
description:
|
|
388
|
+
"returns a dictionary without entries matching a function.",
|
|
389
|
+
examples: [
|
|
390
|
+
"{ a: 1, b: 2 }.reject((key, value) => { value > 1 })",
|
|
391
|
+
"{ a: 1 }.reject((key) => { key == :a })",
|
|
392
|
+
"{ a: 1, b: :x }.reject(String)"
|
|
393
|
+
]
|
|
394
|
+
},
|
|
395
|
+
"reject!" => {
|
|
396
|
+
name: "reject!",
|
|
397
|
+
description: "removes entries matching a function.",
|
|
398
|
+
examples: [
|
|
399
|
+
"{ a: 1, b: 2 }.reject!((key, value) => { value > 1 })",
|
|
400
|
+
"{ a: 1 }.reject!((key) => { key == :a })",
|
|
401
|
+
"{ a: 1, b: :x }.reject!(String)"
|
|
402
|
+
]
|
|
403
|
+
},
|
|
404
|
+
"select" => {
|
|
405
|
+
name: "select",
|
|
406
|
+
description: "returns a dictionary with entries matching a function.",
|
|
407
|
+
examples: [
|
|
408
|
+
"{ a: 1, b: 2 }.select((key, value) => { value > 1 })",
|
|
409
|
+
"{ a: 1 }.select((key) => { key == :a })",
|
|
410
|
+
"{ a: 1, b: :x }.select(String)"
|
|
411
|
+
]
|
|
412
|
+
},
|
|
413
|
+
"filter" => {
|
|
414
|
+
name: "filter",
|
|
415
|
+
description: "alias for select.",
|
|
416
|
+
examples: [
|
|
417
|
+
"{ a: 1, b: 2 }.filter((key, value) => { value > 1 })",
|
|
418
|
+
"{ a: 1 }.filter((key) => { key == :a })",
|
|
419
|
+
"{ a: 1, b: :x }.filter(String)"
|
|
420
|
+
]
|
|
421
|
+
},
|
|
422
|
+
"select!" => {
|
|
423
|
+
name: "select!",
|
|
424
|
+
description: "keeps entries matching a function.",
|
|
425
|
+
examples: [
|
|
426
|
+
"{ a: 1, b: 2 }.select!((key, value) => { value > 1 })",
|
|
427
|
+
"{ a: 1 }.select!((key) => { key == :a })",
|
|
428
|
+
"{ a: 1, b: :x }.select!(String)"
|
|
429
|
+
]
|
|
430
|
+
},
|
|
431
|
+
"filter!" => {
|
|
432
|
+
name: "filter!",
|
|
433
|
+
description: "alias for select!.",
|
|
434
|
+
examples: [
|
|
435
|
+
"{ a: 1, b: 2 }.filter!((key, value) => { value > 1 })",
|
|
436
|
+
"{ a: 1 }.filter!((key) => { key == :a })",
|
|
437
|
+
"{ a: 1, b: :x }.filter!(String)"
|
|
438
|
+
]
|
|
439
|
+
},
|
|
440
|
+
"set" => {
|
|
441
|
+
name: "set",
|
|
442
|
+
description: "sets a key to a value and returns the value.",
|
|
443
|
+
examples: [
|
|
444
|
+
"{ a: 1 }.set(:b, 2)",
|
|
445
|
+
"{}.set(:a, 1)",
|
|
446
|
+
"{ a: 1 }.set(:a, 2)"
|
|
447
|
+
]
|
|
448
|
+
},
|
|
449
|
+
"size" => {
|
|
450
|
+
name: "size",
|
|
451
|
+
description: "returns the number of entries.",
|
|
452
|
+
examples: ["{}.size", "{ a: 1 }.size", "{ a: 1, b: 2 }.size"]
|
|
453
|
+
},
|
|
454
|
+
"length" => {
|
|
455
|
+
name: "length",
|
|
456
|
+
description: "alias for size.",
|
|
457
|
+
examples: ["{}.length", "{ a: 1 }.length", "{ a: 1, b: 2 }.length"]
|
|
458
|
+
},
|
|
459
|
+
"slice" => {
|
|
460
|
+
name: "slice",
|
|
461
|
+
description: "returns a dictionary with only the given keys.",
|
|
462
|
+
examples: [
|
|
463
|
+
"{ a: 1, b: 2 }.slice(:a)",
|
|
464
|
+
"{ a: 1, b: 2 }.slice(:a, :b)",
|
|
465
|
+
"{ a: 1 }.slice(:missing)"
|
|
466
|
+
]
|
|
467
|
+
},
|
|
468
|
+
"to_list" => {
|
|
469
|
+
name: "to_list",
|
|
470
|
+
description: "returns key-value entries as a list.",
|
|
471
|
+
examples: ["{ a: 1 }.to_list", "{ a: 1, b: 2 }.to_list", "{}.to_list"]
|
|
472
|
+
},
|
|
473
|
+
"entries" => {
|
|
474
|
+
name: "entries",
|
|
475
|
+
description: "returns key-value entries as a list.",
|
|
476
|
+
examples: ["{ a: 1 }.entries", "{ a: 1, b: 2 }.entries", "{}.entries"]
|
|
477
|
+
},
|
|
478
|
+
"to_dictionary" => {
|
|
479
|
+
name: "to_dictionary",
|
|
480
|
+
description: "returns the dictionary.",
|
|
481
|
+
examples: [
|
|
482
|
+
"{ a: 1 }.to_dictionary",
|
|
483
|
+
"{ a: 1, b: 2 }.to_dictionary",
|
|
484
|
+
"{}.to_dictionary"
|
|
485
|
+
]
|
|
486
|
+
},
|
|
487
|
+
"to_context" => {
|
|
488
|
+
name: "to_context",
|
|
489
|
+
description: "converts the dictionary to a context.",
|
|
490
|
+
examples: [
|
|
491
|
+
"{ a: 1 }.to_context",
|
|
492
|
+
"{ a: 1, b: 2 }.to_context",
|
|
493
|
+
"{}.to_context"
|
|
494
|
+
]
|
|
495
|
+
},
|
|
496
|
+
"to_query" => {
|
|
497
|
+
name: "to_query",
|
|
498
|
+
description: "converts the dictionary to a query string.",
|
|
499
|
+
examples: [
|
|
500
|
+
"{ a: 1 }.to_query",
|
|
501
|
+
"{ a: 1, b: 2 }.to_query",
|
|
502
|
+
"{ q: :ruby }.to_query(:search)"
|
|
503
|
+
]
|
|
504
|
+
},
|
|
505
|
+
"transform_keys" => {
|
|
506
|
+
name: "transform_keys",
|
|
507
|
+
description:
|
|
508
|
+
"returns a dictionary with keys transformed by a function.",
|
|
509
|
+
examples: [
|
|
510
|
+
"{ a: 1 }.transform_keys((key) => { key.to_string })",
|
|
511
|
+
"{ a: 1 }.transform_keys((key, value) => { value })",
|
|
512
|
+
"{ a: 1 }.transform_keys((key, value, index) => { index })"
|
|
513
|
+
]
|
|
514
|
+
},
|
|
515
|
+
"transform_keys!" => {
|
|
516
|
+
name: "transform_keys!",
|
|
517
|
+
description: "transforms keys in the receiver with a function.",
|
|
518
|
+
examples: [
|
|
519
|
+
"{ a: 1 }.transform_keys!((key) => { key.to_string })",
|
|
520
|
+
"{ a: 1 }.transform_keys!((key, value) => { value })",
|
|
521
|
+
"{ a: 1 }.transform_keys!((key, value, index) => { index })"
|
|
522
|
+
]
|
|
523
|
+
},
|
|
524
|
+
"transform_values" => {
|
|
525
|
+
name: "transform_values",
|
|
526
|
+
description:
|
|
527
|
+
"returns a dictionary with values transformed by a key-value function.",
|
|
528
|
+
examples: [
|
|
529
|
+
"{ a: 1 }.transform_values((key, value) => { value + 1 })",
|
|
530
|
+
"{ a: 1 }.transform_values((key, value) => { key })",
|
|
531
|
+
"{ a: 1 }.transform_values((key, value, index) => { index })"
|
|
532
|
+
]
|
|
533
|
+
},
|
|
534
|
+
"transform_values!" => {
|
|
535
|
+
name: "transform_values!",
|
|
536
|
+
description:
|
|
537
|
+
"transforms values in the receiver with a key-value function.",
|
|
538
|
+
examples: [
|
|
539
|
+
"{ a: 1 }.transform_values!((key, value) => { value + 1 })",
|
|
540
|
+
"{ a: 1 }.transform_values!((key, value) => { key })",
|
|
541
|
+
"{ a: 1 }.transform_values!((key, value, index) => { index })"
|
|
542
|
+
]
|
|
543
|
+
},
|
|
544
|
+
"values" => {
|
|
545
|
+
name: "values",
|
|
546
|
+
description: "returns all values, values for keys, or mapped values.",
|
|
547
|
+
examples: [
|
|
548
|
+
"{ a: 1, b: 2 }.values",
|
|
549
|
+
"{ a: 1, b: 2 }.values(:a)",
|
|
550
|
+
"{ a: 1, b: 2 }.values(:a, () => { 0 })"
|
|
551
|
+
]
|
|
552
|
+
},
|
|
553
|
+
"values_at" => {
|
|
554
|
+
name: "values_at",
|
|
555
|
+
description: "returns values for the given keys.",
|
|
556
|
+
examples: [
|
|
557
|
+
"{ a: 1, b: 2 }.values_at(:a)",
|
|
558
|
+
"{ a: 1, b: 2 }.values_at(:a, :b)",
|
|
559
|
+
"{ a: 1 }.values_at(:missing)"
|
|
560
|
+
]
|
|
561
|
+
},
|
|
562
|
+
"associate" => {
|
|
563
|
+
name: "associate",
|
|
564
|
+
description:
|
|
565
|
+
"returns the key-value entry for a key, otherwise nothing.",
|
|
566
|
+
examples: [
|
|
567
|
+
"{ a: 1 }.associate(:a)",
|
|
568
|
+
"{ a: 1, b: 2 }.associate(:b)",
|
|
569
|
+
"{}.associate(:a)"
|
|
570
|
+
]
|
|
571
|
+
},
|
|
572
|
+
"right_associate" => {
|
|
573
|
+
name: "right_associate",
|
|
574
|
+
description:
|
|
575
|
+
"returns the first key-value entry for a value, otherwise nothing.",
|
|
576
|
+
examples: [
|
|
577
|
+
"{ a: 1 }.right_associate(1)",
|
|
578
|
+
"{ a: 1, b: 2 }.right_associate(2)",
|
|
579
|
+
"{}.right_associate(1)"
|
|
580
|
+
]
|
|
581
|
+
},
|
|
582
|
+
"deep_duplicate" => {
|
|
583
|
+
name: "deep_duplicate",
|
|
584
|
+
description: "returns a deep duplicate of the dictionary.",
|
|
585
|
+
examples: [
|
|
586
|
+
"{ a: 1 }.deep_duplicate",
|
|
587
|
+
"{ a: [1] }.deep_duplicate",
|
|
588
|
+
"{}.deep_duplicate"
|
|
589
|
+
]
|
|
590
|
+
},
|
|
591
|
+
"many?" => {
|
|
592
|
+
name: "many?",
|
|
593
|
+
description:
|
|
594
|
+
"returns whether the dictionary has more than one entry.",
|
|
595
|
+
examples: ["{ a: 1, b: 2 }.many?", "{ a: 1 }.many?", "{}.many?"]
|
|
596
|
+
},
|
|
597
|
+
"positive?" => {
|
|
598
|
+
name: "positive?",
|
|
599
|
+
description: "returns whether the dictionary size is positive.",
|
|
600
|
+
examples: [
|
|
601
|
+
"{ a: 1 }.positive?",
|
|
602
|
+
"{}.positive?",
|
|
603
|
+
"{ a: 1, b: 2 }.positive?"
|
|
604
|
+
]
|
|
605
|
+
},
|
|
606
|
+
"negative?" => {
|
|
607
|
+
name: "negative?",
|
|
608
|
+
description: "returns whether the dictionary size is negative.",
|
|
609
|
+
examples: [
|
|
610
|
+
"{}.negative?",
|
|
611
|
+
"{ a: 1 }.negative?",
|
|
612
|
+
"{ a: 1, b: 2 }.negative?"
|
|
613
|
+
]
|
|
614
|
+
},
|
|
615
|
+
"zero?" => {
|
|
616
|
+
name: "zero?",
|
|
617
|
+
description: "returns whether the dictionary size is zero.",
|
|
618
|
+
examples: ["{}.zero?", "{ a: 1 }.zero?", "{ a: 1, b: 2 }.zero?"]
|
|
619
|
+
},
|
|
620
|
+
"one?" => {
|
|
621
|
+
name: "one?",
|
|
622
|
+
description: "returns whether the dictionary size is one.",
|
|
623
|
+
examples: [
|
|
624
|
+
"Dictionary.from_entries((1..1).to_list.map((x) => { [x, x] })).one?",
|
|
625
|
+
"Dictionary.from_entries((1..2).to_list.map((x) => { [x, x] })).one?",
|
|
626
|
+
"{}.one?"
|
|
627
|
+
]
|
|
628
|
+
},
|
|
629
|
+
"two?" => {
|
|
630
|
+
name: "two?",
|
|
631
|
+
description: "returns whether the dictionary size is two.",
|
|
632
|
+
examples: [
|
|
633
|
+
"Dictionary.from_entries((1..2).to_list.map((x) => { [x, x] })).two?",
|
|
634
|
+
"Dictionary.from_entries((1..3).to_list.map((x) => { [x, x] })).two?",
|
|
635
|
+
"{}.two?"
|
|
636
|
+
]
|
|
637
|
+
},
|
|
638
|
+
"three?" => {
|
|
639
|
+
name: "three?",
|
|
640
|
+
description: "returns whether the dictionary size is three.",
|
|
641
|
+
examples: [
|
|
642
|
+
"Dictionary.from_entries((1..3).to_list.map((x) => { [x, x] })).three?",
|
|
643
|
+
"Dictionary.from_entries((1..4).to_list.map((x) => { [x, x] })).three?",
|
|
644
|
+
"{}.three?"
|
|
645
|
+
]
|
|
646
|
+
},
|
|
647
|
+
"four?" => {
|
|
648
|
+
name: "four?",
|
|
649
|
+
description: "returns whether the dictionary size is four.",
|
|
650
|
+
examples: [
|
|
651
|
+
"Dictionary.from_entries((1..4).to_list.map((x) => { [x, x] })).four?",
|
|
652
|
+
"Dictionary.from_entries((1..5).to_list.map((x) => { [x, x] })).four?",
|
|
653
|
+
"{}.four?"
|
|
654
|
+
]
|
|
655
|
+
},
|
|
656
|
+
"five?" => {
|
|
657
|
+
name: "five?",
|
|
658
|
+
description: "returns whether the dictionary size is five.",
|
|
659
|
+
examples: [
|
|
660
|
+
"Dictionary.from_entries((1..5).to_list.map((x) => { [x, x] })).five?",
|
|
661
|
+
"Dictionary.from_entries((1..6).to_list.map((x) => { [x, x] })).five?",
|
|
662
|
+
"{}.five?"
|
|
663
|
+
]
|
|
664
|
+
},
|
|
665
|
+
"six?" => {
|
|
666
|
+
name: "six?",
|
|
667
|
+
description: "returns whether the dictionary size is six.",
|
|
668
|
+
examples: [
|
|
669
|
+
"Dictionary.from_entries((1..6).to_list.map((x) => { [x, x] })).six?",
|
|
670
|
+
"Dictionary.from_entries((1..7).to_list.map((x) => { [x, x] })).six?",
|
|
671
|
+
"{}.six?"
|
|
672
|
+
]
|
|
673
|
+
},
|
|
674
|
+
"seven?" => {
|
|
675
|
+
name: "seven?",
|
|
676
|
+
description: "returns whether the dictionary size is seven.",
|
|
677
|
+
examples: [
|
|
678
|
+
"Dictionary.from_entries((1..7).to_list.map((x) => { [x, x] })).seven?",
|
|
679
|
+
"Dictionary.from_entries((1..8).to_list.map((x) => { [x, x] })).seven?",
|
|
680
|
+
"{}.seven?"
|
|
681
|
+
]
|
|
682
|
+
},
|
|
683
|
+
"eight?" => {
|
|
684
|
+
name: "eight?",
|
|
685
|
+
description: "returns whether the dictionary size is eight.",
|
|
686
|
+
examples: [
|
|
687
|
+
"Dictionary.from_entries((1..8).to_list.map((x) => { [x, x] })).eight?",
|
|
688
|
+
"Dictionary.from_entries((1..9).to_list.map((x) => { [x, x] })).eight?",
|
|
689
|
+
"{}.eight?"
|
|
690
|
+
]
|
|
691
|
+
},
|
|
692
|
+
"nine?" => {
|
|
693
|
+
name: "nine?",
|
|
694
|
+
description: "returns whether the dictionary size is nine.",
|
|
695
|
+
examples: [
|
|
696
|
+
"Dictionary.from_entries((1..9).to_list.map((x) => { [x, x] })).nine?",
|
|
697
|
+
"Dictionary.from_entries((1..10).to_list.map((x) => { [x, x] })).nine?",
|
|
698
|
+
"{}.nine?"
|
|
699
|
+
]
|
|
700
|
+
},
|
|
701
|
+
"ten?" => {
|
|
702
|
+
name: "ten?",
|
|
703
|
+
description: "returns whether the dictionary size is ten.",
|
|
704
|
+
examples: [
|
|
705
|
+
"Dictionary.from_entries((1..10).to_list.map((x) => { [x, x] })).ten?",
|
|
706
|
+
"Dictionary.from_entries((1..11).to_list.map((x) => { [x, x] })).ten?",
|
|
707
|
+
"{}.ten?"
|
|
708
|
+
]
|
|
709
|
+
},
|
|
710
|
+
"eleven?" => {
|
|
711
|
+
name: "eleven?",
|
|
712
|
+
description: "returns whether the dictionary size is eleven.",
|
|
713
|
+
examples: [
|
|
714
|
+
"Dictionary.from_entries((1..11).to_list.map((x) => { [x, x] })).eleven?",
|
|
715
|
+
"Dictionary.from_entries((1..12).to_list.map((x) => { [x, x] })).eleven?",
|
|
716
|
+
"{}.eleven?"
|
|
717
|
+
]
|
|
718
|
+
},
|
|
719
|
+
"twelve?" => {
|
|
720
|
+
name: "twelve?",
|
|
721
|
+
description: "returns whether the dictionary size is twelve.",
|
|
722
|
+
examples: [
|
|
723
|
+
"Dictionary.from_entries((1..12).to_list.map((x) => { [x, x] })).twelve?",
|
|
724
|
+
"Dictionary.from_entries((1..13).to_list.map((x) => { [x, x] })).twelve?",
|
|
725
|
+
"{}.twelve?"
|
|
726
|
+
]
|
|
727
|
+
},
|
|
728
|
+
"thirteen?" => {
|
|
729
|
+
name: "thirteen?",
|
|
730
|
+
description: "returns whether the dictionary size is thirteen.",
|
|
731
|
+
examples: [
|
|
732
|
+
"Dictionary.from_entries((1..13).to_list.map((x) => { [x, x] })).thirteen?",
|
|
733
|
+
"Dictionary.from_entries((1..14).to_list.map((x) => { [x, x] })).thirteen?",
|
|
734
|
+
"{}.thirteen?"
|
|
735
|
+
]
|
|
736
|
+
},
|
|
737
|
+
"fourteen?" => {
|
|
738
|
+
name: "fourteen?",
|
|
739
|
+
description: "returns whether the dictionary size is fourteen.",
|
|
740
|
+
examples: [
|
|
741
|
+
"Dictionary.from_entries((1..14).to_list.map((x) => { [x, x] })).fourteen?",
|
|
742
|
+
"Dictionary.from_entries((1..15).to_list.map((x) => { [x, x] })).fourteen?",
|
|
743
|
+
"{}.fourteen?"
|
|
744
|
+
]
|
|
745
|
+
},
|
|
746
|
+
"fifteen?" => {
|
|
747
|
+
name: "fifteen?",
|
|
748
|
+
description: "returns whether the dictionary size is fifteen.",
|
|
749
|
+
examples: [
|
|
750
|
+
"Dictionary.from_entries((1..15).to_list.map((x) => { [x, x] })).fifteen?",
|
|
751
|
+
"Dictionary.from_entries((1..16).to_list.map((x) => { [x, x] })).fifteen?",
|
|
752
|
+
"{}.fifteen?"
|
|
753
|
+
]
|
|
754
|
+
},
|
|
755
|
+
"sixteen?" => {
|
|
756
|
+
name: "sixteen?",
|
|
757
|
+
description: "returns whether the dictionary size is sixteen.",
|
|
758
|
+
examples: [
|
|
759
|
+
"Dictionary.from_entries((1..16).to_list.map((x) => { [x, x] })).sixteen?",
|
|
760
|
+
"Dictionary.from_entries((1..17).to_list.map((x) => { [x, x] })).sixteen?",
|
|
761
|
+
"{}.sixteen?"
|
|
762
|
+
]
|
|
763
|
+
},
|
|
764
|
+
"seventeen?" => {
|
|
765
|
+
name: "seventeen?",
|
|
766
|
+
description: "returns whether the dictionary size is seventeen.",
|
|
767
|
+
examples: [
|
|
768
|
+
"Dictionary.from_entries((1..17).to_list.map((x) => { [x, x] })).seventeen?",
|
|
769
|
+
"Dictionary.from_entries((1..18).to_list.map((x) => { [x, x] })).seventeen?",
|
|
770
|
+
"{}.seventeen?"
|
|
771
|
+
]
|
|
772
|
+
},
|
|
773
|
+
"eighteen?" => {
|
|
774
|
+
name: "eighteen?",
|
|
775
|
+
description: "returns whether the dictionary size is eighteen.",
|
|
776
|
+
examples: [
|
|
777
|
+
"Dictionary.from_entries((1..18).to_list.map((x) => { [x, x] })).eighteen?",
|
|
778
|
+
"Dictionary.from_entries((1..19).to_list.map((x) => { [x, x] })).eighteen?",
|
|
779
|
+
"{}.eighteen?"
|
|
780
|
+
]
|
|
781
|
+
},
|
|
782
|
+
"nineteen?" => {
|
|
783
|
+
name: "nineteen?",
|
|
784
|
+
description: "returns whether the dictionary size is nineteen.",
|
|
785
|
+
examples: [
|
|
786
|
+
"Dictionary.from_entries((1..19).to_list.map((x) => { [x, x] })).nineteen?",
|
|
787
|
+
"Dictionary.from_entries((1..20).to_list.map((x) => { [x, x] })).nineteen?",
|
|
788
|
+
"{}.nineteen?"
|
|
789
|
+
]
|
|
790
|
+
},
|
|
791
|
+
"twenty?" => {
|
|
792
|
+
name: "twenty?",
|
|
793
|
+
description: "returns whether the dictionary size is twenty.",
|
|
794
|
+
examples: [
|
|
795
|
+
"Dictionary.from_entries((1..20).to_list.map((x) => { [x, x] })).twenty?",
|
|
796
|
+
"Dictionary.from_entries((1..21).to_list.map((x) => { [x, x] })).twenty?",
|
|
797
|
+
"{}.twenty?"
|
|
798
|
+
]
|
|
799
|
+
},
|
|
800
|
+
"twenty_one?" => {
|
|
801
|
+
name: "twenty_one?",
|
|
802
|
+
description: "returns whether the dictionary size is twenty one.",
|
|
803
|
+
examples: [
|
|
804
|
+
"Dictionary.from_entries((1..21).to_list.map((x) => { [x, x] })).twenty_one?",
|
|
805
|
+
"Dictionary.from_entries((1..22).to_list.map((x) => { [x, x] })).twenty_one?",
|
|
806
|
+
"{}.twenty_one?"
|
|
807
|
+
]
|
|
808
|
+
},
|
|
809
|
+
"twenty_two?" => {
|
|
810
|
+
name: "twenty_two?",
|
|
811
|
+
description: "returns whether the dictionary size is twenty two.",
|
|
812
|
+
examples: [
|
|
813
|
+
"Dictionary.from_entries((1..22).to_list.map((x) => { [x, x] })).twenty_two?",
|
|
814
|
+
"Dictionary.from_entries((1..23).to_list.map((x) => { [x, x] })).twenty_two?",
|
|
815
|
+
"{}.twenty_two?"
|
|
816
|
+
]
|
|
817
|
+
},
|
|
818
|
+
"twenty_three?" => {
|
|
819
|
+
name: "twenty_three?",
|
|
820
|
+
description: "returns whether the dictionary size is twenty three.",
|
|
821
|
+
examples: [
|
|
822
|
+
"Dictionary.from_entries((1..23).to_list.map((x) => { [x, x] })).twenty_three?",
|
|
823
|
+
"Dictionary.from_entries((1..24).to_list.map((x) => { [x, x] })).twenty_three?",
|
|
824
|
+
"{}.twenty_three?"
|
|
825
|
+
]
|
|
826
|
+
},
|
|
827
|
+
"twenty_four?" => {
|
|
828
|
+
name: "twenty_four?",
|
|
829
|
+
description: "returns whether the dictionary size is twenty four.",
|
|
830
|
+
examples: [
|
|
831
|
+
"Dictionary.from_entries((1..24).to_list.map((x) => { [x, x] })).twenty_four?",
|
|
832
|
+
"Dictionary.from_entries((1..25).to_list.map((x) => { [x, x] })).twenty_four?",
|
|
833
|
+
"{}.twenty_four?"
|
|
834
|
+
]
|
|
835
|
+
},
|
|
836
|
+
"twenty_five?" => {
|
|
837
|
+
name: "twenty_five?",
|
|
838
|
+
description: "returns whether the dictionary size is twenty five.",
|
|
839
|
+
examples: [
|
|
840
|
+
"Dictionary.from_entries((1..25).to_list.map((x) => { [x, x] })).twenty_five?",
|
|
841
|
+
"Dictionary.from_entries((1..26).to_list.map((x) => { [x, x] })).twenty_five?",
|
|
842
|
+
"{}.twenty_five?"
|
|
843
|
+
]
|
|
844
|
+
},
|
|
845
|
+
"twenty_six?" => {
|
|
846
|
+
name: "twenty_six?",
|
|
847
|
+
description: "returns whether the dictionary size is twenty six.",
|
|
848
|
+
examples: [
|
|
849
|
+
"Dictionary.from_entries((1..26).to_list.map((x) => { [x, x] })).twenty_six?",
|
|
850
|
+
"Dictionary.from_entries((1..27).to_list.map((x) => { [x, x] })).twenty_six?",
|
|
851
|
+
"{}.twenty_six?"
|
|
852
|
+
]
|
|
853
|
+
},
|
|
854
|
+
"twenty_seven?" => {
|
|
855
|
+
name: "twenty_seven?",
|
|
856
|
+
description: "returns whether the dictionary size is twenty seven.",
|
|
857
|
+
examples: [
|
|
858
|
+
"Dictionary.from_entries((1..27).to_list.map((x) => { [x, x] })).twenty_seven?",
|
|
859
|
+
"Dictionary.from_entries((1..28).to_list.map((x) => { [x, x] })).twenty_seven?",
|
|
860
|
+
"{}.twenty_seven?"
|
|
861
|
+
]
|
|
862
|
+
},
|
|
863
|
+
"twenty_eight?" => {
|
|
864
|
+
name: "twenty_eight?",
|
|
865
|
+
description: "returns whether the dictionary size is twenty eight.",
|
|
866
|
+
examples: [
|
|
867
|
+
"Dictionary.from_entries((1..28).to_list.map((x) => { [x, x] })).twenty_eight?",
|
|
868
|
+
"Dictionary.from_entries((1..29).to_list.map((x) => { [x, x] })).twenty_eight?",
|
|
869
|
+
"{}.twenty_eight?"
|
|
870
|
+
]
|
|
871
|
+
},
|
|
872
|
+
"twenty_nine?" => {
|
|
873
|
+
name: "twenty_nine?",
|
|
874
|
+
description: "returns whether the dictionary size is twenty nine.",
|
|
875
|
+
examples: [
|
|
876
|
+
"Dictionary.from_entries((1..29).to_list.map((x) => { [x, x] })).twenty_nine?",
|
|
877
|
+
"Dictionary.from_entries((1..30).to_list.map((x) => { [x, x] })).twenty_nine?",
|
|
878
|
+
"{}.twenty_nine?"
|
|
879
|
+
]
|
|
880
|
+
},
|
|
881
|
+
"thirty?" => {
|
|
882
|
+
name: "thirty?",
|
|
883
|
+
description: "returns whether the dictionary size is thirty.",
|
|
884
|
+
examples: [
|
|
885
|
+
"Dictionary.from_entries((1..30).to_list.map((x) => { [x, x] })).thirty?",
|
|
886
|
+
"Dictionary.from_entries((1..31).to_list.map((x) => { [x, x] })).thirty?",
|
|
887
|
+
"{}.thirty?"
|
|
888
|
+
]
|
|
889
|
+
},
|
|
890
|
+
"thirty_one?" => {
|
|
891
|
+
name: "thirty_one?",
|
|
892
|
+
description: "returns whether the dictionary size is thirty one.",
|
|
893
|
+
examples: [
|
|
894
|
+
"Dictionary.from_entries((1..31).to_list.map((x) => { [x, x] })).thirty_one?",
|
|
895
|
+
"Dictionary.from_entries((1..32).to_list.map((x) => { [x, x] })).thirty_one?",
|
|
896
|
+
"{}.thirty_one?"
|
|
897
|
+
]
|
|
898
|
+
},
|
|
899
|
+
"thirty_two?" => {
|
|
900
|
+
name: "thirty_two?",
|
|
901
|
+
description: "returns whether the dictionary size is thirty two.",
|
|
902
|
+
examples: [
|
|
903
|
+
"Dictionary.from_entries((1..32).to_list.map((x) => { [x, x] })).thirty_two?",
|
|
904
|
+
"Dictionary.from_entries((1..33).to_list.map((x) => { [x, x] })).thirty_two?",
|
|
905
|
+
"{}.thirty_two?"
|
|
906
|
+
]
|
|
907
|
+
},
|
|
908
|
+
"thirty_three?" => {
|
|
909
|
+
name: "thirty_three?",
|
|
910
|
+
description: "returns whether the dictionary size is thirty three.",
|
|
911
|
+
examples: [
|
|
912
|
+
"Dictionary.from_entries((1..33).to_list.map((x) => { [x, x] })).thirty_three?",
|
|
913
|
+
"Dictionary.from_entries((1..34).to_list.map((x) => { [x, x] })).thirty_three?",
|
|
914
|
+
"{}.thirty_three?"
|
|
915
|
+
]
|
|
916
|
+
},
|
|
917
|
+
"thirty_four?" => {
|
|
918
|
+
name: "thirty_four?",
|
|
919
|
+
description: "returns whether the dictionary size is thirty four.",
|
|
920
|
+
examples: [
|
|
921
|
+
"Dictionary.from_entries((1..34).to_list.map((x) => { [x, x] })).thirty_four?",
|
|
922
|
+
"Dictionary.from_entries((1..35).to_list.map((x) => { [x, x] })).thirty_four?",
|
|
923
|
+
"{}.thirty_four?"
|
|
924
|
+
]
|
|
925
|
+
},
|
|
926
|
+
"thirty_five?" => {
|
|
927
|
+
name: "thirty_five?",
|
|
928
|
+
description: "returns whether the dictionary size is thirty five.",
|
|
929
|
+
examples: [
|
|
930
|
+
"Dictionary.from_entries((1..35).to_list.map((x) => { [x, x] })).thirty_five?",
|
|
931
|
+
"Dictionary.from_entries((1..36).to_list.map((x) => { [x, x] })).thirty_five?",
|
|
932
|
+
"{}.thirty_five?"
|
|
933
|
+
]
|
|
934
|
+
},
|
|
935
|
+
"thirty_six?" => {
|
|
936
|
+
name: "thirty_six?",
|
|
937
|
+
description: "returns whether the dictionary size is thirty six.",
|
|
938
|
+
examples: [
|
|
939
|
+
"Dictionary.from_entries((1..36).to_list.map((x) => { [x, x] })).thirty_six?",
|
|
940
|
+
"Dictionary.from_entries((1..37).to_list.map((x) => { [x, x] })).thirty_six?",
|
|
941
|
+
"{}.thirty_six?"
|
|
942
|
+
]
|
|
943
|
+
},
|
|
944
|
+
"thirty_seven?" => {
|
|
945
|
+
name: "thirty_seven?",
|
|
946
|
+
description: "returns whether the dictionary size is thirty seven.",
|
|
947
|
+
examples: [
|
|
948
|
+
"Dictionary.from_entries((1..37).to_list.map((x) => { [x, x] })).thirty_seven?",
|
|
949
|
+
"Dictionary.from_entries((1..38).to_list.map((x) => { [x, x] })).thirty_seven?",
|
|
950
|
+
"{}.thirty_seven?"
|
|
951
|
+
]
|
|
952
|
+
},
|
|
953
|
+
"thirty_eight?" => {
|
|
954
|
+
name: "thirty_eight?",
|
|
955
|
+
description: "returns whether the dictionary size is thirty eight.",
|
|
956
|
+
examples: [
|
|
957
|
+
"Dictionary.from_entries((1..38).to_list.map((x) => { [x, x] })).thirty_eight?",
|
|
958
|
+
"Dictionary.from_entries((1..39).to_list.map((x) => { [x, x] })).thirty_eight?",
|
|
959
|
+
"{}.thirty_eight?"
|
|
960
|
+
]
|
|
961
|
+
},
|
|
962
|
+
"thirty_nine?" => {
|
|
963
|
+
name: "thirty_nine?",
|
|
964
|
+
description: "returns whether the dictionary size is thirty nine.",
|
|
965
|
+
examples: [
|
|
966
|
+
"Dictionary.from_entries((1..39).to_list.map((x) => { [x, x] })).thirty_nine?",
|
|
967
|
+
"Dictionary.from_entries((1..40).to_list.map((x) => { [x, x] })).thirty_nine?",
|
|
968
|
+
"{}.thirty_nine?"
|
|
969
|
+
]
|
|
970
|
+
},
|
|
971
|
+
"forty?" => {
|
|
972
|
+
name: "forty?",
|
|
973
|
+
description: "returns whether the dictionary size is forty.",
|
|
974
|
+
examples: [
|
|
975
|
+
"Dictionary.from_entries((1..40).to_list.map((x) => { [x, x] })).forty?",
|
|
976
|
+
"Dictionary.from_entries((1..41).to_list.map((x) => { [x, x] })).forty?",
|
|
977
|
+
"{}.forty?"
|
|
978
|
+
]
|
|
979
|
+
},
|
|
980
|
+
"forty_one?" => {
|
|
981
|
+
name: "forty_one?",
|
|
982
|
+
description: "returns whether the dictionary size is forty one.",
|
|
983
|
+
examples: [
|
|
984
|
+
"Dictionary.from_entries((1..41).to_list.map((x) => { [x, x] })).forty_one?",
|
|
985
|
+
"Dictionary.from_entries((1..42).to_list.map((x) => { [x, x] })).forty_one?",
|
|
986
|
+
"{}.forty_one?"
|
|
987
|
+
]
|
|
988
|
+
},
|
|
989
|
+
"forty_two?" => {
|
|
990
|
+
name: "forty_two?",
|
|
991
|
+
description: "returns whether the dictionary size is forty two.",
|
|
992
|
+
examples: [
|
|
993
|
+
"Dictionary.from_entries((1..42).to_list.map((x) => { [x, x] })).forty_two?",
|
|
994
|
+
"Dictionary.from_entries((1..43).to_list.map((x) => { [x, x] })).forty_two?",
|
|
995
|
+
"{}.forty_two?"
|
|
996
|
+
]
|
|
997
|
+
},
|
|
998
|
+
"forty_three?" => {
|
|
999
|
+
name: "forty_three?",
|
|
1000
|
+
description: "returns whether the dictionary size is forty three.",
|
|
1001
|
+
examples: [
|
|
1002
|
+
"Dictionary.from_entries((1..43).to_list.map((x) => { [x, x] })).forty_three?",
|
|
1003
|
+
"Dictionary.from_entries((1..44).to_list.map((x) => { [x, x] })).forty_three?",
|
|
1004
|
+
"{}.forty_three?"
|
|
1005
|
+
]
|
|
1006
|
+
},
|
|
1007
|
+
"forty_four?" => {
|
|
1008
|
+
name: "forty_four?",
|
|
1009
|
+
description: "returns whether the dictionary size is forty four.",
|
|
1010
|
+
examples: [
|
|
1011
|
+
"Dictionary.from_entries((1..44).to_list.map((x) => { [x, x] })).forty_four?",
|
|
1012
|
+
"Dictionary.from_entries((1..45).to_list.map((x) => { [x, x] })).forty_four?",
|
|
1013
|
+
"{}.forty_four?"
|
|
1014
|
+
]
|
|
1015
|
+
},
|
|
1016
|
+
"forty_five?" => {
|
|
1017
|
+
name: "forty_five?",
|
|
1018
|
+
description: "returns whether the dictionary size is forty five.",
|
|
1019
|
+
examples: [
|
|
1020
|
+
"Dictionary.from_entries((1..45).to_list.map((x) => { [x, x] })).forty_five?",
|
|
1021
|
+
"Dictionary.from_entries((1..46).to_list.map((x) => { [x, x] })).forty_five?",
|
|
1022
|
+
"{}.forty_five?"
|
|
1023
|
+
]
|
|
1024
|
+
},
|
|
1025
|
+
"forty_six?" => {
|
|
1026
|
+
name: "forty_six?",
|
|
1027
|
+
description: "returns whether the dictionary size is forty six.",
|
|
1028
|
+
examples: [
|
|
1029
|
+
"Dictionary.from_entries((1..46).to_list.map((x) => { [x, x] })).forty_six?",
|
|
1030
|
+
"Dictionary.from_entries((1..47).to_list.map((x) => { [x, x] })).forty_six?",
|
|
1031
|
+
"{}.forty_six?"
|
|
1032
|
+
]
|
|
1033
|
+
},
|
|
1034
|
+
"forty_seven?" => {
|
|
1035
|
+
name: "forty_seven?",
|
|
1036
|
+
description: "returns whether the dictionary size is forty seven.",
|
|
1037
|
+
examples: [
|
|
1038
|
+
"Dictionary.from_entries((1..47).to_list.map((x) => { [x, x] })).forty_seven?",
|
|
1039
|
+
"Dictionary.from_entries((1..48).to_list.map((x) => { [x, x] })).forty_seven?",
|
|
1040
|
+
"{}.forty_seven?"
|
|
1041
|
+
]
|
|
1042
|
+
},
|
|
1043
|
+
"forty_eight?" => {
|
|
1044
|
+
name: "forty_eight?",
|
|
1045
|
+
description: "returns whether the dictionary size is forty eight.",
|
|
1046
|
+
examples: [
|
|
1047
|
+
"Dictionary.from_entries((1..48).to_list.map((x) => { [x, x] })).forty_eight?",
|
|
1048
|
+
"Dictionary.from_entries((1..49).to_list.map((x) => { [x, x] })).forty_eight?",
|
|
1049
|
+
"{}.forty_eight?"
|
|
1050
|
+
]
|
|
1051
|
+
},
|
|
1052
|
+
"forty_nine?" => {
|
|
1053
|
+
name: "forty_nine?",
|
|
1054
|
+
description: "returns whether the dictionary size is forty nine.",
|
|
1055
|
+
examples: [
|
|
1056
|
+
"Dictionary.from_entries((1..49).to_list.map((x) => { [x, x] })).forty_nine?",
|
|
1057
|
+
"Dictionary.from_entries((1..50).to_list.map((x) => { [x, x] })).forty_nine?",
|
|
1058
|
+
"{}.forty_nine?"
|
|
1059
|
+
]
|
|
1060
|
+
},
|
|
1061
|
+
"fifty?" => {
|
|
1062
|
+
name: "fifty?",
|
|
1063
|
+
description: "returns whether the dictionary size is fifty.",
|
|
1064
|
+
examples: [
|
|
1065
|
+
"Dictionary.from_entries((1..50).to_list.map((x) => { [x, x] })).fifty?",
|
|
1066
|
+
"Dictionary.from_entries((1..51).to_list.map((x) => { [x, x] })).fifty?",
|
|
1067
|
+
"{}.fifty?"
|
|
1068
|
+
]
|
|
1069
|
+
},
|
|
1070
|
+
"fifty_one?" => {
|
|
1071
|
+
name: "fifty_one?",
|
|
1072
|
+
description: "returns whether the dictionary size is fifty one.",
|
|
1073
|
+
examples: [
|
|
1074
|
+
"Dictionary.from_entries((1..51).to_list.map((x) => { [x, x] })).fifty_one?",
|
|
1075
|
+
"Dictionary.from_entries((1..52).to_list.map((x) => { [x, x] })).fifty_one?",
|
|
1076
|
+
"{}.fifty_one?"
|
|
1077
|
+
]
|
|
1078
|
+
},
|
|
1079
|
+
"fifty_two?" => {
|
|
1080
|
+
name: "fifty_two?",
|
|
1081
|
+
description: "returns whether the dictionary size is fifty two.",
|
|
1082
|
+
examples: [
|
|
1083
|
+
"Dictionary.from_entries((1..52).to_list.map((x) => { [x, x] })).fifty_two?",
|
|
1084
|
+
"Dictionary.from_entries((1..53).to_list.map((x) => { [x, x] })).fifty_two?",
|
|
1085
|
+
"{}.fifty_two?"
|
|
1086
|
+
]
|
|
1087
|
+
},
|
|
1088
|
+
"fifty_three?" => {
|
|
1089
|
+
name: "fifty_three?",
|
|
1090
|
+
description: "returns whether the dictionary size is fifty three.",
|
|
1091
|
+
examples: [
|
|
1092
|
+
"Dictionary.from_entries((1..53).to_list.map((x) => { [x, x] })).fifty_three?",
|
|
1093
|
+
"Dictionary.from_entries((1..54).to_list.map((x) => { [x, x] })).fifty_three?",
|
|
1094
|
+
"{}.fifty_three?"
|
|
1095
|
+
]
|
|
1096
|
+
},
|
|
1097
|
+
"fifty_four?" => {
|
|
1098
|
+
name: "fifty_four?",
|
|
1099
|
+
description: "returns whether the dictionary size is fifty four.",
|
|
1100
|
+
examples: [
|
|
1101
|
+
"Dictionary.from_entries((1..54).to_list.map((x) => { [x, x] })).fifty_four?",
|
|
1102
|
+
"Dictionary.from_entries((1..55).to_list.map((x) => { [x, x] })).fifty_four?",
|
|
1103
|
+
"{}.fifty_four?"
|
|
1104
|
+
]
|
|
1105
|
+
},
|
|
1106
|
+
"fifty_five?" => {
|
|
1107
|
+
name: "fifty_five?",
|
|
1108
|
+
description: "returns whether the dictionary size is fifty five.",
|
|
1109
|
+
examples: [
|
|
1110
|
+
"Dictionary.from_entries((1..55).to_list.map((x) => { [x, x] })).fifty_five?",
|
|
1111
|
+
"Dictionary.from_entries((1..56).to_list.map((x) => { [x, x] })).fifty_five?",
|
|
1112
|
+
"{}.fifty_five?"
|
|
1113
|
+
]
|
|
1114
|
+
},
|
|
1115
|
+
"fifty_six?" => {
|
|
1116
|
+
name: "fifty_six?",
|
|
1117
|
+
description: "returns whether the dictionary size is fifty six.",
|
|
1118
|
+
examples: [
|
|
1119
|
+
"Dictionary.from_entries((1..56).to_list.map((x) => { [x, x] })).fifty_six?",
|
|
1120
|
+
"Dictionary.from_entries((1..57).to_list.map((x) => { [x, x] })).fifty_six?",
|
|
1121
|
+
"{}.fifty_six?"
|
|
1122
|
+
]
|
|
1123
|
+
},
|
|
1124
|
+
"fifty_seven?" => {
|
|
1125
|
+
name: "fifty_seven?",
|
|
1126
|
+
description: "returns whether the dictionary size is fifty seven.",
|
|
1127
|
+
examples: [
|
|
1128
|
+
"Dictionary.from_entries((1..57).to_list.map((x) => { [x, x] })).fifty_seven?",
|
|
1129
|
+
"Dictionary.from_entries((1..58).to_list.map((x) => { [x, x] })).fifty_seven?",
|
|
1130
|
+
"{}.fifty_seven?"
|
|
1131
|
+
]
|
|
1132
|
+
},
|
|
1133
|
+
"fifty_eight?" => {
|
|
1134
|
+
name: "fifty_eight?",
|
|
1135
|
+
description: "returns whether the dictionary size is fifty eight.",
|
|
1136
|
+
examples: [
|
|
1137
|
+
"Dictionary.from_entries((1..58).to_list.map((x) => { [x, x] })).fifty_eight?",
|
|
1138
|
+
"Dictionary.from_entries((1..59).to_list.map((x) => { [x, x] })).fifty_eight?",
|
|
1139
|
+
"{}.fifty_eight?"
|
|
1140
|
+
]
|
|
1141
|
+
},
|
|
1142
|
+
"fifty_nine?" => {
|
|
1143
|
+
name: "fifty_nine?",
|
|
1144
|
+
description: "returns whether the dictionary size is fifty nine.",
|
|
1145
|
+
examples: [
|
|
1146
|
+
"Dictionary.from_entries((1..59).to_list.map((x) => { [x, x] })).fifty_nine?",
|
|
1147
|
+
"Dictionary.from_entries((1..60).to_list.map((x) => { [x, x] })).fifty_nine?",
|
|
1148
|
+
"{}.fifty_nine?"
|
|
1149
|
+
]
|
|
1150
|
+
},
|
|
1151
|
+
"sixty?" => {
|
|
1152
|
+
name: "sixty?",
|
|
1153
|
+
description: "returns whether the dictionary size is sixty.",
|
|
1154
|
+
examples: [
|
|
1155
|
+
"Dictionary.from_entries((1..60).to_list.map((x) => { [x, x] })).sixty?",
|
|
1156
|
+
"Dictionary.from_entries((1..61).to_list.map((x) => { [x, x] })).sixty?",
|
|
1157
|
+
"{}.sixty?"
|
|
1158
|
+
]
|
|
1159
|
+
},
|
|
1160
|
+
"sixty_one?" => {
|
|
1161
|
+
name: "sixty_one?",
|
|
1162
|
+
description: "returns whether the dictionary size is sixty one.",
|
|
1163
|
+
examples: [
|
|
1164
|
+
"Dictionary.from_entries((1..61).to_list.map((x) => { [x, x] })).sixty_one?",
|
|
1165
|
+
"Dictionary.from_entries((1..62).to_list.map((x) => { [x, x] })).sixty_one?",
|
|
1166
|
+
"{}.sixty_one?"
|
|
1167
|
+
]
|
|
1168
|
+
},
|
|
1169
|
+
"sixty_two?" => {
|
|
1170
|
+
name: "sixty_two?",
|
|
1171
|
+
description: "returns whether the dictionary size is sixty two.",
|
|
1172
|
+
examples: [
|
|
1173
|
+
"Dictionary.from_entries((1..62).to_list.map((x) => { [x, x] })).sixty_two?",
|
|
1174
|
+
"Dictionary.from_entries((1..63).to_list.map((x) => { [x, x] })).sixty_two?",
|
|
1175
|
+
"{}.sixty_two?"
|
|
1176
|
+
]
|
|
1177
|
+
},
|
|
1178
|
+
"sixty_three?" => {
|
|
1179
|
+
name: "sixty_three?",
|
|
1180
|
+
description: "returns whether the dictionary size is sixty three.",
|
|
1181
|
+
examples: [
|
|
1182
|
+
"Dictionary.from_entries((1..63).to_list.map((x) => { [x, x] })).sixty_three?",
|
|
1183
|
+
"Dictionary.from_entries((1..64).to_list.map((x) => { [x, x] })).sixty_three?",
|
|
1184
|
+
"{}.sixty_three?"
|
|
1185
|
+
]
|
|
1186
|
+
},
|
|
1187
|
+
"sixty_four?" => {
|
|
1188
|
+
name: "sixty_four?",
|
|
1189
|
+
description: "returns whether the dictionary size is sixty four.",
|
|
1190
|
+
examples: [
|
|
1191
|
+
"Dictionary.from_entries((1..64).to_list.map((x) => { [x, x] })).sixty_four?",
|
|
1192
|
+
"Dictionary.from_entries((1..65).to_list.map((x) => { [x, x] })).sixty_four?",
|
|
1193
|
+
"{}.sixty_four?"
|
|
1194
|
+
]
|
|
1195
|
+
},
|
|
1196
|
+
"sixty_five?" => {
|
|
1197
|
+
name: "sixty_five?",
|
|
1198
|
+
description: "returns whether the dictionary size is sixty five.",
|
|
1199
|
+
examples: [
|
|
1200
|
+
"Dictionary.from_entries((1..65).to_list.map((x) => { [x, x] })).sixty_five?",
|
|
1201
|
+
"Dictionary.from_entries((1..66).to_list.map((x) => { [x, x] })).sixty_five?",
|
|
1202
|
+
"{}.sixty_five?"
|
|
1203
|
+
]
|
|
1204
|
+
},
|
|
1205
|
+
"sixty_six?" => {
|
|
1206
|
+
name: "sixty_six?",
|
|
1207
|
+
description: "returns whether the dictionary size is sixty six.",
|
|
1208
|
+
examples: [
|
|
1209
|
+
"Dictionary.from_entries((1..66).to_list.map((x) => { [x, x] })).sixty_six?",
|
|
1210
|
+
"Dictionary.from_entries((1..67).to_list.map((x) => { [x, x] })).sixty_six?",
|
|
1211
|
+
"{}.sixty_six?"
|
|
1212
|
+
]
|
|
1213
|
+
},
|
|
1214
|
+
"sixty_seven?" => {
|
|
1215
|
+
name: "sixty_seven?",
|
|
1216
|
+
description: "returns whether the dictionary size is sixty seven.",
|
|
1217
|
+
examples: [
|
|
1218
|
+
"Dictionary.from_entries((1..67).to_list.map((x) => { [x, x] })).sixty_seven?",
|
|
1219
|
+
"Dictionary.from_entries((1..68).to_list.map((x) => { [x, x] })).sixty_seven?",
|
|
1220
|
+
"{}.sixty_seven?"
|
|
1221
|
+
]
|
|
1222
|
+
},
|
|
1223
|
+
"sixty_eight?" => {
|
|
1224
|
+
name: "sixty_eight?",
|
|
1225
|
+
description: "returns whether the dictionary size is sixty eight.",
|
|
1226
|
+
examples: [
|
|
1227
|
+
"Dictionary.from_entries((1..68).to_list.map((x) => { [x, x] })).sixty_eight?",
|
|
1228
|
+
"Dictionary.from_entries((1..69).to_list.map((x) => { [x, x] })).sixty_eight?",
|
|
1229
|
+
"{}.sixty_eight?"
|
|
1230
|
+
]
|
|
1231
|
+
},
|
|
1232
|
+
"sixty_nine?" => {
|
|
1233
|
+
name: "sixty_nine?",
|
|
1234
|
+
description: "returns whether the dictionary size is sixty nine.",
|
|
1235
|
+
examples: [
|
|
1236
|
+
"Dictionary.from_entries((1..69).to_list.map((x) => { [x, x] })).sixty_nine?",
|
|
1237
|
+
"Dictionary.from_entries((1..70).to_list.map((x) => { [x, x] })).sixty_nine?",
|
|
1238
|
+
"{}.sixty_nine?"
|
|
1239
|
+
]
|
|
1240
|
+
},
|
|
1241
|
+
"seventy?" => {
|
|
1242
|
+
name: "seventy?",
|
|
1243
|
+
description: "returns whether the dictionary size is seventy.",
|
|
1244
|
+
examples: [
|
|
1245
|
+
"Dictionary.from_entries((1..70).to_list.map((x) => { [x, x] })).seventy?",
|
|
1246
|
+
"Dictionary.from_entries((1..71).to_list.map((x) => { [x, x] })).seventy?",
|
|
1247
|
+
"{}.seventy?"
|
|
1248
|
+
]
|
|
1249
|
+
},
|
|
1250
|
+
"seventy_one?" => {
|
|
1251
|
+
name: "seventy_one?",
|
|
1252
|
+
description: "returns whether the dictionary size is seventy one.",
|
|
1253
|
+
examples: [
|
|
1254
|
+
"Dictionary.from_entries((1..71).to_list.map((x) => { [x, x] })).seventy_one?",
|
|
1255
|
+
"Dictionary.from_entries((1..72).to_list.map((x) => { [x, x] })).seventy_one?",
|
|
1256
|
+
"{}.seventy_one?"
|
|
1257
|
+
]
|
|
1258
|
+
},
|
|
1259
|
+
"seventy_two?" => {
|
|
1260
|
+
name: "seventy_two?",
|
|
1261
|
+
description: "returns whether the dictionary size is seventy two.",
|
|
1262
|
+
examples: [
|
|
1263
|
+
"Dictionary.from_entries((1..72).to_list.map((x) => { [x, x] })).seventy_two?",
|
|
1264
|
+
"Dictionary.from_entries((1..73).to_list.map((x) => { [x, x] })).seventy_two?",
|
|
1265
|
+
"{}.seventy_two?"
|
|
1266
|
+
]
|
|
1267
|
+
},
|
|
1268
|
+
"seventy_three?" => {
|
|
1269
|
+
name: "seventy_three?",
|
|
1270
|
+
description: "returns whether the dictionary size is seventy three.",
|
|
1271
|
+
examples: [
|
|
1272
|
+
"Dictionary.from_entries((1..73).to_list.map((x) => { [x, x] })).seventy_three?",
|
|
1273
|
+
"Dictionary.from_entries((1..74).to_list.map((x) => { [x, x] })).seventy_three?",
|
|
1274
|
+
"{}.seventy_three?"
|
|
1275
|
+
]
|
|
1276
|
+
},
|
|
1277
|
+
"seventy_four?" => {
|
|
1278
|
+
name: "seventy_four?",
|
|
1279
|
+
description: "returns whether the dictionary size is seventy four.",
|
|
1280
|
+
examples: [
|
|
1281
|
+
"Dictionary.from_entries((1..74).to_list.map((x) => { [x, x] })).seventy_four?",
|
|
1282
|
+
"Dictionary.from_entries((1..75).to_list.map((x) => { [x, x] })).seventy_four?",
|
|
1283
|
+
"{}.seventy_four?"
|
|
1284
|
+
]
|
|
1285
|
+
},
|
|
1286
|
+
"seventy_five?" => {
|
|
1287
|
+
name: "seventy_five?",
|
|
1288
|
+
description: "returns whether the dictionary size is seventy five.",
|
|
1289
|
+
examples: [
|
|
1290
|
+
"Dictionary.from_entries((1..75).to_list.map((x) => { [x, x] })).seventy_five?",
|
|
1291
|
+
"Dictionary.from_entries((1..76).to_list.map((x) => { [x, x] })).seventy_five?",
|
|
1292
|
+
"{}.seventy_five?"
|
|
1293
|
+
]
|
|
1294
|
+
},
|
|
1295
|
+
"seventy_six?" => {
|
|
1296
|
+
name: "seventy_six?",
|
|
1297
|
+
description: "returns whether the dictionary size is seventy six.",
|
|
1298
|
+
examples: [
|
|
1299
|
+
"Dictionary.from_entries((1..76).to_list.map((x) => { [x, x] })).seventy_six?",
|
|
1300
|
+
"Dictionary.from_entries((1..77).to_list.map((x) => { [x, x] })).seventy_six?",
|
|
1301
|
+
"{}.seventy_six?"
|
|
1302
|
+
]
|
|
1303
|
+
},
|
|
1304
|
+
"seventy_seven?" => {
|
|
1305
|
+
name: "seventy_seven?",
|
|
1306
|
+
description: "returns whether the dictionary size is seventy seven.",
|
|
1307
|
+
examples: [
|
|
1308
|
+
"Dictionary.from_entries((1..77).to_list.map((x) => { [x, x] })).seventy_seven?",
|
|
1309
|
+
"Dictionary.from_entries((1..78).to_list.map((x) => { [x, x] })).seventy_seven?",
|
|
1310
|
+
"{}.seventy_seven?"
|
|
1311
|
+
]
|
|
1312
|
+
},
|
|
1313
|
+
"seventy_eight?" => {
|
|
1314
|
+
name: "seventy_eight?",
|
|
1315
|
+
description: "returns whether the dictionary size is seventy eight.",
|
|
1316
|
+
examples: [
|
|
1317
|
+
"Dictionary.from_entries((1..78).to_list.map((x) => { [x, x] })).seventy_eight?",
|
|
1318
|
+
"Dictionary.from_entries((1..79).to_list.map((x) => { [x, x] })).seventy_eight?",
|
|
1319
|
+
"{}.seventy_eight?"
|
|
1320
|
+
]
|
|
1321
|
+
},
|
|
1322
|
+
"seventy_nine?" => {
|
|
1323
|
+
name: "seventy_nine?",
|
|
1324
|
+
description: "returns whether the dictionary size is seventy nine.",
|
|
1325
|
+
examples: [
|
|
1326
|
+
"Dictionary.from_entries((1..79).to_list.map((x) => { [x, x] })).seventy_nine?",
|
|
1327
|
+
"Dictionary.from_entries((1..80).to_list.map((x) => { [x, x] })).seventy_nine?",
|
|
1328
|
+
"{}.seventy_nine?"
|
|
1329
|
+
]
|
|
1330
|
+
},
|
|
1331
|
+
"eighty?" => {
|
|
1332
|
+
name: "eighty?",
|
|
1333
|
+
description: "returns whether the dictionary size is eighty.",
|
|
1334
|
+
examples: [
|
|
1335
|
+
"Dictionary.from_entries((1..80).to_list.map((x) => { [x, x] })).eighty?",
|
|
1336
|
+
"Dictionary.from_entries((1..81).to_list.map((x) => { [x, x] })).eighty?",
|
|
1337
|
+
"{}.eighty?"
|
|
1338
|
+
]
|
|
1339
|
+
},
|
|
1340
|
+
"eighty_one?" => {
|
|
1341
|
+
name: "eighty_one?",
|
|
1342
|
+
description: "returns whether the dictionary size is eighty one.",
|
|
1343
|
+
examples: [
|
|
1344
|
+
"Dictionary.from_entries((1..81).to_list.map((x) => { [x, x] })).eighty_one?",
|
|
1345
|
+
"Dictionary.from_entries((1..82).to_list.map((x) => { [x, x] })).eighty_one?",
|
|
1346
|
+
"{}.eighty_one?"
|
|
1347
|
+
]
|
|
1348
|
+
},
|
|
1349
|
+
"eighty_two?" => {
|
|
1350
|
+
name: "eighty_two?",
|
|
1351
|
+
description: "returns whether the dictionary size is eighty two.",
|
|
1352
|
+
examples: [
|
|
1353
|
+
"Dictionary.from_entries((1..82).to_list.map((x) => { [x, x] })).eighty_two?",
|
|
1354
|
+
"Dictionary.from_entries((1..83).to_list.map((x) => { [x, x] })).eighty_two?",
|
|
1355
|
+
"{}.eighty_two?"
|
|
1356
|
+
]
|
|
1357
|
+
},
|
|
1358
|
+
"eighty_three?" => {
|
|
1359
|
+
name: "eighty_three?",
|
|
1360
|
+
description: "returns whether the dictionary size is eighty three.",
|
|
1361
|
+
examples: [
|
|
1362
|
+
"Dictionary.from_entries((1..83).to_list.map((x) => { [x, x] })).eighty_three?",
|
|
1363
|
+
"Dictionary.from_entries((1..84).to_list.map((x) => { [x, x] })).eighty_three?",
|
|
1364
|
+
"{}.eighty_three?"
|
|
1365
|
+
]
|
|
1366
|
+
},
|
|
1367
|
+
"eighty_four?" => {
|
|
1368
|
+
name: "eighty_four?",
|
|
1369
|
+
description: "returns whether the dictionary size is eighty four.",
|
|
1370
|
+
examples: [
|
|
1371
|
+
"Dictionary.from_entries((1..84).to_list.map((x) => { [x, x] })).eighty_four?",
|
|
1372
|
+
"Dictionary.from_entries((1..85).to_list.map((x) => { [x, x] })).eighty_four?",
|
|
1373
|
+
"{}.eighty_four?"
|
|
1374
|
+
]
|
|
1375
|
+
},
|
|
1376
|
+
"eighty_five?" => {
|
|
1377
|
+
name: "eighty_five?",
|
|
1378
|
+
description: "returns whether the dictionary size is eighty five.",
|
|
1379
|
+
examples: [
|
|
1380
|
+
"Dictionary.from_entries((1..85).to_list.map((x) => { [x, x] })).eighty_five?",
|
|
1381
|
+
"Dictionary.from_entries((1..86).to_list.map((x) => { [x, x] })).eighty_five?",
|
|
1382
|
+
"{}.eighty_five?"
|
|
1383
|
+
]
|
|
1384
|
+
},
|
|
1385
|
+
"eighty_six?" => {
|
|
1386
|
+
name: "eighty_six?",
|
|
1387
|
+
description: "returns whether the dictionary size is eighty six.",
|
|
1388
|
+
examples: [
|
|
1389
|
+
"Dictionary.from_entries((1..86).to_list.map((x) => { [x, x] })).eighty_six?",
|
|
1390
|
+
"Dictionary.from_entries((1..87).to_list.map((x) => { [x, x] })).eighty_six?",
|
|
1391
|
+
"{}.eighty_six?"
|
|
1392
|
+
]
|
|
1393
|
+
},
|
|
1394
|
+
"eighty_seven?" => {
|
|
1395
|
+
name: "eighty_seven?",
|
|
1396
|
+
description: "returns whether the dictionary size is eighty seven.",
|
|
1397
|
+
examples: [
|
|
1398
|
+
"Dictionary.from_entries((1..87).to_list.map((x) => { [x, x] })).eighty_seven?",
|
|
1399
|
+
"Dictionary.from_entries((1..88).to_list.map((x) => { [x, x] })).eighty_seven?",
|
|
1400
|
+
"{}.eighty_seven?"
|
|
1401
|
+
]
|
|
1402
|
+
},
|
|
1403
|
+
"eighty_eight?" => {
|
|
1404
|
+
name: "eighty_eight?",
|
|
1405
|
+
description: "returns whether the dictionary size is eighty eight.",
|
|
1406
|
+
examples: [
|
|
1407
|
+
"Dictionary.from_entries((1..88).to_list.map((x) => { [x, x] })).eighty_eight?",
|
|
1408
|
+
"Dictionary.from_entries((1..89).to_list.map((x) => { [x, x] })).eighty_eight?",
|
|
1409
|
+
"{}.eighty_eight?"
|
|
1410
|
+
]
|
|
1411
|
+
},
|
|
1412
|
+
"eighty_nine?" => {
|
|
1413
|
+
name: "eighty_nine?",
|
|
1414
|
+
description: "returns whether the dictionary size is eighty nine.",
|
|
1415
|
+
examples: [
|
|
1416
|
+
"Dictionary.from_entries((1..89).to_list.map((x) => { [x, x] })).eighty_nine?",
|
|
1417
|
+
"Dictionary.from_entries((1..90).to_list.map((x) => { [x, x] })).eighty_nine?",
|
|
1418
|
+
"{}.eighty_nine?"
|
|
1419
|
+
]
|
|
1420
|
+
},
|
|
1421
|
+
"ninety?" => {
|
|
1422
|
+
name: "ninety?",
|
|
1423
|
+
description: "returns whether the dictionary size is ninety.",
|
|
1424
|
+
examples: [
|
|
1425
|
+
"Dictionary.from_entries((1..90).to_list.map((x) => { [x, x] })).ninety?",
|
|
1426
|
+
"Dictionary.from_entries((1..91).to_list.map((x) => { [x, x] })).ninety?",
|
|
1427
|
+
"{}.ninety?"
|
|
1428
|
+
]
|
|
1429
|
+
},
|
|
1430
|
+
"ninety_one?" => {
|
|
1431
|
+
name: "ninety_one?",
|
|
1432
|
+
description: "returns whether the dictionary size is ninety one.",
|
|
1433
|
+
examples: [
|
|
1434
|
+
"Dictionary.from_entries((1..91).to_list.map((x) => { [x, x] })).ninety_one?",
|
|
1435
|
+
"Dictionary.from_entries((1..92).to_list.map((x) => { [x, x] })).ninety_one?",
|
|
1436
|
+
"{}.ninety_one?"
|
|
1437
|
+
]
|
|
1438
|
+
},
|
|
1439
|
+
"ninety_two?" => {
|
|
1440
|
+
name: "ninety_two?",
|
|
1441
|
+
description: "returns whether the dictionary size is ninety two.",
|
|
1442
|
+
examples: [
|
|
1443
|
+
"Dictionary.from_entries((1..92).to_list.map((x) => { [x, x] })).ninety_two?",
|
|
1444
|
+
"Dictionary.from_entries((1..93).to_list.map((x) => { [x, x] })).ninety_two?",
|
|
1445
|
+
"{}.ninety_two?"
|
|
1446
|
+
]
|
|
1447
|
+
},
|
|
1448
|
+
"ninety_three?" => {
|
|
1449
|
+
name: "ninety_three?",
|
|
1450
|
+
description: "returns whether the dictionary size is ninety three.",
|
|
1451
|
+
examples: [
|
|
1452
|
+
"Dictionary.from_entries((1..93).to_list.map((x) => { [x, x] })).ninety_three?",
|
|
1453
|
+
"Dictionary.from_entries((1..94).to_list.map((x) => { [x, x] })).ninety_three?",
|
|
1454
|
+
"{}.ninety_three?"
|
|
1455
|
+
]
|
|
1456
|
+
},
|
|
1457
|
+
"ninety_four?" => {
|
|
1458
|
+
name: "ninety_four?",
|
|
1459
|
+
description: "returns whether the dictionary size is ninety four.",
|
|
1460
|
+
examples: [
|
|
1461
|
+
"Dictionary.from_entries((1..94).to_list.map((x) => { [x, x] })).ninety_four?",
|
|
1462
|
+
"Dictionary.from_entries((1..95).to_list.map((x) => { [x, x] })).ninety_four?",
|
|
1463
|
+
"{}.ninety_four?"
|
|
1464
|
+
]
|
|
1465
|
+
},
|
|
1466
|
+
"ninety_five?" => {
|
|
1467
|
+
name: "ninety_five?",
|
|
1468
|
+
description: "returns whether the dictionary size is ninety five.",
|
|
1469
|
+
examples: [
|
|
1470
|
+
"Dictionary.from_entries((1..95).to_list.map((x) => { [x, x] })).ninety_five?",
|
|
1471
|
+
"Dictionary.from_entries((1..96).to_list.map((x) => { [x, x] })).ninety_five?",
|
|
1472
|
+
"{}.ninety_five?"
|
|
1473
|
+
]
|
|
1474
|
+
},
|
|
1475
|
+
"ninety_six?" => {
|
|
1476
|
+
name: "ninety_six?",
|
|
1477
|
+
description: "returns whether the dictionary size is ninety six.",
|
|
1478
|
+
examples: [
|
|
1479
|
+
"Dictionary.from_entries((1..96).to_list.map((x) => { [x, x] })).ninety_six?",
|
|
1480
|
+
"Dictionary.from_entries((1..97).to_list.map((x) => { [x, x] })).ninety_six?",
|
|
1481
|
+
"{}.ninety_six?"
|
|
1482
|
+
]
|
|
1483
|
+
},
|
|
1484
|
+
"ninety_seven?" => {
|
|
1485
|
+
name: "ninety_seven?",
|
|
1486
|
+
description: "returns whether the dictionary size is ninety seven.",
|
|
1487
|
+
examples: [
|
|
1488
|
+
"Dictionary.from_entries((1..97).to_list.map((x) => { [x, x] })).ninety_seven?",
|
|
1489
|
+
"Dictionary.from_entries((1..98).to_list.map((x) => { [x, x] })).ninety_seven?",
|
|
1490
|
+
"{}.ninety_seven?"
|
|
1491
|
+
]
|
|
1492
|
+
},
|
|
1493
|
+
"ninety_eight?" => {
|
|
1494
|
+
name: "ninety_eight?",
|
|
1495
|
+
description: "returns whether the dictionary size is ninety eight.",
|
|
1496
|
+
examples: [
|
|
1497
|
+
"Dictionary.from_entries((1..98).to_list.map((x) => { [x, x] })).ninety_eight?",
|
|
1498
|
+
"Dictionary.from_entries((1..99).to_list.map((x) => { [x, x] })).ninety_eight?",
|
|
1499
|
+
"{}.ninety_eight?"
|
|
1500
|
+
]
|
|
1501
|
+
},
|
|
1502
|
+
"ninety_nine?" => {
|
|
1503
|
+
name: "ninety_nine?",
|
|
1504
|
+
description: "returns whether the dictionary size is ninety nine.",
|
|
1505
|
+
examples: [
|
|
1506
|
+
"Dictionary.from_entries((1..99).to_list.map((x) => { [x, x] })).ninety_nine?",
|
|
1507
|
+
"Dictionary.from_entries((1..100).to_list.map((x) => { [x, x] })).ninety_nine?",
|
|
1508
|
+
"{}.ninety_nine?"
|
|
1509
|
+
]
|
|
1510
|
+
},
|
|
1511
|
+
"one_hundred?" => {
|
|
1512
|
+
name: "one_hundred?",
|
|
1513
|
+
description: "returns whether the dictionary size is one hundred.",
|
|
1514
|
+
examples: [
|
|
1515
|
+
"Dictionary.from_entries((1..100).to_list.map((x) => { [x, x] })).one_hundred?",
|
|
1516
|
+
"Dictionary.from_entries((1..101).to_list.map((x) => { [x, x] })).one_hundred?",
|
|
1517
|
+
"{}.one_hundred?"
|
|
1518
|
+
]
|
|
1519
|
+
}
|
|
1520
|
+
}.freeze
|
|
1521
|
+
|
|
1522
|
+
def self.function_documentation(scope)
|
|
1523
|
+
return INSTANCE_FUNCTIONS if scope == :instance
|
|
1524
|
+
return CLASS_FUNCTIONS if scope == :class
|
|
1525
|
+
|
|
1526
|
+
{}
|
|
1527
|
+
end
|
|
1528
|
+
|
|
6
1529
|
delegate(
|
|
7
1530
|
:code_many?,
|
|
8
1531
|
:code_positive?,
|
|
@@ -129,6 +1652,29 @@ class Code
|
|
|
129
1652
|
.merge(kargs.transform_keys(&:to_code).transform_values(&:to_code))
|
|
130
1653
|
end
|
|
131
1654
|
|
|
1655
|
+
def self.call(**args)
|
|
1656
|
+
code_operator = args.fetch(:operator, nil).to_code
|
|
1657
|
+
code_arguments = args.fetch(:arguments, List.new).to_code
|
|
1658
|
+
code_value = code_arguments.code_first
|
|
1659
|
+
|
|
1660
|
+
case code_operator.to_s
|
|
1661
|
+
when "entries"
|
|
1662
|
+
sig(args) { Dictionary }
|
|
1663
|
+
code_entries(code_value)
|
|
1664
|
+
when "from_entries"
|
|
1665
|
+
sig(args) { List }
|
|
1666
|
+
code_from_entries(code_value)
|
|
1667
|
+
when "assign"
|
|
1668
|
+
sig(args) { Dictionary.repeat(1) }
|
|
1669
|
+
code_assign(*code_arguments.raw)
|
|
1670
|
+
when "has_own?"
|
|
1671
|
+
sig(args) { [Dictionary, Object] }
|
|
1672
|
+
code_has_own?(*code_arguments.raw)
|
|
1673
|
+
else
|
|
1674
|
+
super
|
|
1675
|
+
end
|
|
1676
|
+
end
|
|
1677
|
+
|
|
132
1678
|
def call(**args)
|
|
133
1679
|
code_operator = args.fetch(:operator, nil).to_code
|
|
134
1680
|
code_arguments = args.fetch(:arguments, List.new).to_code
|
|
@@ -171,6 +1717,15 @@ class Code
|
|
|
171
1717
|
when "each"
|
|
172
1718
|
sig(args) { Function }
|
|
173
1719
|
code_each(code_value, **globals)
|
|
1720
|
+
when "each_key"
|
|
1721
|
+
sig(args) { Function }
|
|
1722
|
+
code_each_key(code_value, **globals)
|
|
1723
|
+
when "each_value"
|
|
1724
|
+
sig(args) { Function }
|
|
1725
|
+
code_each_value(code_value, **globals)
|
|
1726
|
+
when "each_pair"
|
|
1727
|
+
sig(args) { Function }
|
|
1728
|
+
code_each_pair(code_value, **globals)
|
|
174
1729
|
when "empty?"
|
|
175
1730
|
sig(args)
|
|
176
1731
|
code_empty?
|
|
@@ -186,10 +1741,13 @@ class Code
|
|
|
186
1741
|
when "flatten"
|
|
187
1742
|
sig(args) { Integer.maybe }
|
|
188
1743
|
code_flatten(code_value)
|
|
189
|
-
when "has_key?"
|
|
1744
|
+
when "has_key?", "key?", "include?", "member?"
|
|
190
1745
|
sig(args) { Object }
|
|
191
1746
|
code_has_key?(code_value)
|
|
192
|
-
when "
|
|
1747
|
+
when "has_own?"
|
|
1748
|
+
sig(args) { Object }
|
|
1749
|
+
code_has_own?(code_value)
|
|
1750
|
+
when "has_value?", "value?"
|
|
193
1751
|
sig(args) { Object }
|
|
194
1752
|
code_has_value?(code_value)
|
|
195
1753
|
when "invert"
|
|
@@ -207,30 +1765,81 @@ class Code
|
|
|
207
1765
|
when "keys"
|
|
208
1766
|
sig(args)
|
|
209
1767
|
code_keys
|
|
1768
|
+
when "map"
|
|
1769
|
+
sig(args) { Function }
|
|
1770
|
+
code_map(code_value, **globals)
|
|
210
1771
|
when "merge"
|
|
211
1772
|
sig(args) { [Dictionary.repeat, Function.maybe] }
|
|
212
1773
|
code_merge(*code_arguments.raw, **globals)
|
|
213
1774
|
when "merge!"
|
|
214
1775
|
sig(args) { [Dictionary.repeat, Function.maybe] }
|
|
215
1776
|
code_merge!(*code_arguments.raw, **globals)
|
|
1777
|
+
when "update"
|
|
1778
|
+
sig(args) { [Dictionary.repeat, Function.maybe] }
|
|
1779
|
+
code_update(*code_arguments.raw, **globals)
|
|
1780
|
+
when "replace"
|
|
1781
|
+
sig(args) { Dictionary }
|
|
1782
|
+
code_replace(code_value)
|
|
1783
|
+
when "store", "set"
|
|
1784
|
+
sig(args) { [Object, Object] }
|
|
1785
|
+
code_store(*code_arguments.raw)
|
|
1786
|
+
when "shift"
|
|
1787
|
+
sig(args)
|
|
1788
|
+
code_shift
|
|
1789
|
+
when "reject!"
|
|
1790
|
+
sig(args) { Function | Class }
|
|
1791
|
+
code_reject!(code_value, **globals)
|
|
1792
|
+
when "reject"
|
|
1793
|
+
sig(args) { Function | Class }
|
|
1794
|
+
code_reject(code_value, **globals)
|
|
216
1795
|
when "select!", "filter!"
|
|
217
1796
|
sig(args) { Function | Class }
|
|
218
1797
|
code_select!(code_value, **globals)
|
|
219
1798
|
when "select", "filter"
|
|
220
1799
|
sig(args) { Function | Class }
|
|
221
1800
|
code_select(code_value, **globals)
|
|
222
|
-
when "size"
|
|
1801
|
+
when "size", "length"
|
|
223
1802
|
sig(args)
|
|
224
1803
|
code_size
|
|
1804
|
+
when "slice"
|
|
1805
|
+
sig(args) { Object.repeat(1) }
|
|
1806
|
+
code_slice(*code_arguments.raw)
|
|
1807
|
+
when "transform_keys"
|
|
1808
|
+
sig(args) { Function }
|
|
1809
|
+
code_transform_keys(code_value, **globals)
|
|
1810
|
+
when "transform_keys!"
|
|
1811
|
+
sig(args) { Function }
|
|
1812
|
+
code_transform_keys!(code_value, **globals)
|
|
225
1813
|
when "transform_values"
|
|
226
1814
|
sig(args) { Function }
|
|
227
1815
|
code_transform_values(code_value, **globals)
|
|
1816
|
+
when "transform_values!"
|
|
1817
|
+
sig(args) { Function }
|
|
1818
|
+
code_transform_values!(code_value, **globals)
|
|
228
1819
|
when "to_query"
|
|
229
1820
|
sig(args) { String.maybe }
|
|
230
1821
|
code_to_query(code_value)
|
|
231
|
-
when "
|
|
1822
|
+
when "to_list", "entries"
|
|
232
1823
|
sig(args)
|
|
233
|
-
|
|
1824
|
+
code_to_list
|
|
1825
|
+
when "to_dictionary"
|
|
1826
|
+
sig(args)
|
|
1827
|
+
code_to_dictionary
|
|
1828
|
+
when "to_context"
|
|
1829
|
+
sig(args)
|
|
1830
|
+
code_to_context
|
|
1831
|
+
when "values"
|
|
1832
|
+
sig(args) { [Object.repeat, Function.maybe] }
|
|
1833
|
+
code_values(*code_arguments.raw, **globals)
|
|
1834
|
+
when "values_at"
|
|
1835
|
+
sig(args) { Object.repeat(1) }
|
|
1836
|
+
code_values_at(*code_arguments.raw)
|
|
1837
|
+
when "associate"
|
|
1838
|
+
sig(args) { Object }
|
|
1839
|
+
code_associate(code_value)
|
|
1840
|
+
when "right_associate"
|
|
1841
|
+
sig(args) { Object }
|
|
1842
|
+
code_right_associate(code_value)
|
|
234
1843
|
when "many?"
|
|
235
1844
|
sig(args)
|
|
236
1845
|
code_many?
|
|
@@ -590,6 +2199,27 @@ class Code
|
|
|
590
2199
|
self
|
|
591
2200
|
end
|
|
592
2201
|
|
|
2202
|
+
def self.code_entries(dictionary)
|
|
2203
|
+
dictionary.to_code.code_to_list
|
|
2204
|
+
end
|
|
2205
|
+
|
|
2206
|
+
def self.code_from_entries(entries)
|
|
2207
|
+
entries.to_code.code_to_dictionary
|
|
2208
|
+
end
|
|
2209
|
+
|
|
2210
|
+
def self.code_assign(*dictionaries)
|
|
2211
|
+
Dictionary.new(
|
|
2212
|
+
dictionaries
|
|
2213
|
+
.to_code
|
|
2214
|
+
.raw
|
|
2215
|
+
.reduce({}) { |acc, item| acc.merge(item.raw) }
|
|
2216
|
+
)
|
|
2217
|
+
end
|
|
2218
|
+
|
|
2219
|
+
def self.code_has_own?(dictionary, key)
|
|
2220
|
+
dictionary.to_code.code_has_key?(key)
|
|
2221
|
+
end
|
|
2222
|
+
|
|
593
2223
|
def code_compact(argument = nil, **globals)
|
|
594
2224
|
code_argument = argument.to_code
|
|
595
2225
|
|
|
@@ -764,6 +2394,31 @@ class Code
|
|
|
764
2394
|
e.code_value
|
|
765
2395
|
end
|
|
766
2396
|
|
|
2397
|
+
def code_each_key(argument, **globals)
|
|
2398
|
+
code_argument = argument.to_code
|
|
2399
|
+
|
|
2400
|
+
raw.each.with_index do |(key, value), index|
|
|
2401
|
+
code_argument.call(
|
|
2402
|
+
arguments: List.new([key, value, Integer.new(index), self]),
|
|
2403
|
+
**globals
|
|
2404
|
+
)
|
|
2405
|
+
rescue Error::Next => e
|
|
2406
|
+
e.code_value
|
|
2407
|
+
end
|
|
2408
|
+
|
|
2409
|
+
self
|
|
2410
|
+
rescue Error::Break => e
|
|
2411
|
+
e.code_value
|
|
2412
|
+
end
|
|
2413
|
+
|
|
2414
|
+
def code_each_value(argument, **globals)
|
|
2415
|
+
code_each_key(argument, **globals)
|
|
2416
|
+
end
|
|
2417
|
+
|
|
2418
|
+
def code_each_pair(argument, **globals)
|
|
2419
|
+
code_each_key(argument, **globals)
|
|
2420
|
+
end
|
|
2421
|
+
|
|
767
2422
|
def code_empty?
|
|
768
2423
|
Boolean.new(raw.empty?)
|
|
769
2424
|
end
|
|
@@ -849,6 +2504,10 @@ class Code
|
|
|
849
2504
|
Boolean.new(raw.key?(code_key))
|
|
850
2505
|
end
|
|
851
2506
|
|
|
2507
|
+
def code_has_own?(key)
|
|
2508
|
+
code_has_key?(key)
|
|
2509
|
+
end
|
|
2510
|
+
|
|
852
2511
|
def code_has_value?(key)
|
|
853
2512
|
code_key = key.to_code
|
|
854
2513
|
Boolean.new(raw.value?(code_key))
|
|
@@ -918,6 +2577,24 @@ class Code
|
|
|
918
2577
|
List.new(raw.keys)
|
|
919
2578
|
end
|
|
920
2579
|
|
|
2580
|
+
def code_map(function, **globals)
|
|
2581
|
+
code_function = function.to_code
|
|
2582
|
+
|
|
2583
|
+
List.new(
|
|
2584
|
+
raw.map.with_index do |(key, value), index|
|
|
2585
|
+
code_function.call(
|
|
2586
|
+
arguments:
|
|
2587
|
+
List.new([key.to_code, value.to_code, index.to_code, self]),
|
|
2588
|
+
**globals
|
|
2589
|
+
)
|
|
2590
|
+
rescue Error::Next => e
|
|
2591
|
+
e.code_value
|
|
2592
|
+
end
|
|
2593
|
+
)
|
|
2594
|
+
rescue Error::Break => e
|
|
2595
|
+
e.code_value
|
|
2596
|
+
end
|
|
2597
|
+
|
|
921
2598
|
def code_merge(*arguments, **globals)
|
|
922
2599
|
arguments = arguments.to_code.raw
|
|
923
2600
|
|
|
@@ -1000,6 +2677,27 @@ class Code
|
|
|
1000
2677
|
e.code_value
|
|
1001
2678
|
end
|
|
1002
2679
|
|
|
2680
|
+
def code_update(*arguments, **globals)
|
|
2681
|
+
code_merge!(*arguments, **globals)
|
|
2682
|
+
end
|
|
2683
|
+
|
|
2684
|
+
def code_replace(dictionary)
|
|
2685
|
+
code_dictionary = dictionary.to_code
|
|
2686
|
+
|
|
2687
|
+
self.raw = code_dictionary.raw.dup
|
|
2688
|
+
self
|
|
2689
|
+
end
|
|
2690
|
+
|
|
2691
|
+
def code_store(key, value)
|
|
2692
|
+
code_set(key, value)
|
|
2693
|
+
end
|
|
2694
|
+
|
|
2695
|
+
def code_shift
|
|
2696
|
+
pair = raw.shift
|
|
2697
|
+
|
|
2698
|
+
pair ? List.new(pair) : Nothing.new
|
|
2699
|
+
end
|
|
2700
|
+
|
|
1003
2701
|
def code_select!(argument, **globals)
|
|
1004
2702
|
code_argument = argument.to_code
|
|
1005
2703
|
|
|
@@ -1046,6 +2744,52 @@ class Code
|
|
|
1046
2744
|
e.code_value
|
|
1047
2745
|
end
|
|
1048
2746
|
|
|
2747
|
+
def code_reject!(argument, **globals)
|
|
2748
|
+
code_argument = argument.to_code
|
|
2749
|
+
|
|
2750
|
+
if code_argument.is_a?(Class)
|
|
2751
|
+
raw.reject! { |_, value| value.is_a?(code_argument.raw) }
|
|
2752
|
+
else
|
|
2753
|
+
raw.reject!.with_index do |(key, value), index|
|
|
2754
|
+
code_argument.call(
|
|
2755
|
+
arguments:
|
|
2756
|
+
List.new([key.to_code, value.to_code, index.to_code, self]),
|
|
2757
|
+
**globals
|
|
2758
|
+
).truthy?
|
|
2759
|
+
rescue Error::Next => e
|
|
2760
|
+
e.code_value.truthy?
|
|
2761
|
+
end
|
|
2762
|
+
end
|
|
2763
|
+
|
|
2764
|
+
self
|
|
2765
|
+
rescue Error::Break => e
|
|
2766
|
+
e.code_value
|
|
2767
|
+
end
|
|
2768
|
+
|
|
2769
|
+
def code_reject(argument, **globals)
|
|
2770
|
+
code_argument = argument.to_code
|
|
2771
|
+
|
|
2772
|
+
if code_argument.is_a?(Class)
|
|
2773
|
+
Dictionary.new(
|
|
2774
|
+
raw.reject { |_, value| value.is_a?(code_argument.raw) }
|
|
2775
|
+
)
|
|
2776
|
+
else
|
|
2777
|
+
Dictionary.new(
|
|
2778
|
+
raw.reject.with_index do |(key, value), index|
|
|
2779
|
+
code_argument.call(
|
|
2780
|
+
arguments:
|
|
2781
|
+
List.new([key.to_code, value.to_code, index.to_code, self]),
|
|
2782
|
+
**globals
|
|
2783
|
+
).truthy?
|
|
2784
|
+
rescue Error::Next => e
|
|
2785
|
+
e.code_value.truthy?
|
|
2786
|
+
end
|
|
2787
|
+
)
|
|
2788
|
+
end
|
|
2789
|
+
rescue Error::Break => e
|
|
2790
|
+
e.code_value
|
|
2791
|
+
end
|
|
2792
|
+
|
|
1049
2793
|
def code_set(key, value)
|
|
1050
2794
|
code_key = key.to_code
|
|
1051
2795
|
code_value = value.to_code
|
|
@@ -1057,6 +2801,19 @@ class Code
|
|
|
1057
2801
|
Integer.new(raw.size)
|
|
1058
2802
|
end
|
|
1059
2803
|
|
|
2804
|
+
def code_slice(*arguments)
|
|
2805
|
+
code_arguments = arguments.to_code
|
|
2806
|
+
Dictionary.new(raw.slice(*code_arguments.raw))
|
|
2807
|
+
end
|
|
2808
|
+
|
|
2809
|
+
def code_to_list
|
|
2810
|
+
List.new(raw.map { |key, value| List.new([key, value]) })
|
|
2811
|
+
end
|
|
2812
|
+
|
|
2813
|
+
def code_to_dictionary
|
|
2814
|
+
self
|
|
2815
|
+
end
|
|
2816
|
+
|
|
1060
2817
|
def code_to_context
|
|
1061
2818
|
Context.new(raw)
|
|
1062
2819
|
end
|
|
@@ -1067,6 +2824,35 @@ class Code
|
|
|
1067
2824
|
String.new(raw.to_query(code_namespace.raw))
|
|
1068
2825
|
end
|
|
1069
2826
|
|
|
2827
|
+
def code_transform_keys(function, **globals)
|
|
2828
|
+
code_function = function.to_code
|
|
2829
|
+
|
|
2830
|
+
Dictionary.new(
|
|
2831
|
+
raw
|
|
2832
|
+
.map
|
|
2833
|
+
.with_index do |(key, value), index|
|
|
2834
|
+
[
|
|
2835
|
+
code_function.call(
|
|
2836
|
+
arguments:
|
|
2837
|
+
List.new([key.to_code, value.to_code, index.to_code, self]),
|
|
2838
|
+
**globals
|
|
2839
|
+
),
|
|
2840
|
+
value.to_code
|
|
2841
|
+
]
|
|
2842
|
+
rescue Error::Next => e
|
|
2843
|
+
[e.code_value, value.to_code]
|
|
2844
|
+
end
|
|
2845
|
+
.to_h
|
|
2846
|
+
)
|
|
2847
|
+
rescue Error::Break => e
|
|
2848
|
+
e.code_value
|
|
2849
|
+
end
|
|
2850
|
+
|
|
2851
|
+
def code_transform_keys!(function, **globals)
|
|
2852
|
+
self.raw = code_transform_keys(function, **globals).raw
|
|
2853
|
+
self
|
|
2854
|
+
end
|
|
2855
|
+
|
|
1070
2856
|
def code_transform_values(function, **globals)
|
|
1071
2857
|
code_function = function.to_code
|
|
1072
2858
|
|
|
@@ -1091,14 +2877,78 @@ class Code
|
|
|
1091
2877
|
e.code_value
|
|
1092
2878
|
end
|
|
1093
2879
|
|
|
1094
|
-
def
|
|
1095
|
-
|
|
2880
|
+
def code_transform_values!(function, **globals)
|
|
2881
|
+
self.raw = code_transform_values(function, **globals).raw
|
|
2882
|
+
self
|
|
1096
2883
|
end
|
|
1097
2884
|
|
|
1098
|
-
def
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
2885
|
+
def code_values(*arguments, **globals)
|
|
2886
|
+
arguments = arguments.to_code.raw
|
|
2887
|
+
code_function =
|
|
2888
|
+
(arguments.last if arguments.last.is_a?(Function)).to_code
|
|
2889
|
+
|
|
2890
|
+
arguments = arguments[..-2] unless code_function.nothing?
|
|
2891
|
+
|
|
2892
|
+
entries =
|
|
2893
|
+
if arguments.empty?
|
|
2894
|
+
raw.to_a
|
|
2895
|
+
else
|
|
2896
|
+
arguments.map { |key| [key, raw.fetch(key, Nothing.new)] }
|
|
2897
|
+
end
|
|
2898
|
+
|
|
2899
|
+
if code_function.nothing?
|
|
2900
|
+
List.new(entries.map(&:second))
|
|
2901
|
+
else
|
|
2902
|
+
List.new(
|
|
2903
|
+
entries.map.with_index do |(key, value), index|
|
|
2904
|
+
code_function.call(
|
|
2905
|
+
arguments:
|
|
2906
|
+
List.new([key.to_code, value.to_code, index.to_code, self]),
|
|
2907
|
+
**globals
|
|
2908
|
+
)
|
|
2909
|
+
rescue Error::Next => e
|
|
2910
|
+
e.code_value
|
|
2911
|
+
end
|
|
2912
|
+
)
|
|
2913
|
+
end
|
|
2914
|
+
rescue Error::Break => e
|
|
2915
|
+
e.code_value
|
|
2916
|
+
end
|
|
2917
|
+
|
|
2918
|
+
def code_values_at(*keys)
|
|
2919
|
+
code_keys = keys.to_code
|
|
2920
|
+
|
|
2921
|
+
List.new(raw.values_at(*code_keys.raw))
|
|
2922
|
+
end
|
|
2923
|
+
|
|
2924
|
+
def code_associate(key)
|
|
2925
|
+
code_key = key.to_code
|
|
2926
|
+
|
|
2927
|
+
raw.key?(code_key) ? List.new([code_key, raw[code_key]]) : Nothing.new
|
|
2928
|
+
end
|
|
2929
|
+
|
|
2930
|
+
def code_right_associate(value)
|
|
2931
|
+
code_value = value.to_code
|
|
2932
|
+
pair = raw.detect { |_, entry_value| entry_value == code_value }
|
|
2933
|
+
|
|
2934
|
+
pair ? List.new(pair) : Nothing.new
|
|
2935
|
+
end
|
|
2936
|
+
|
|
2937
|
+
def code_deep_duplicate(seen = {})
|
|
2938
|
+
seen.compare_by_identity unless seen.compare_by_identity?
|
|
2939
|
+
return seen[self] if seen.key?(self)
|
|
2940
|
+
|
|
2941
|
+
duplicate = Dictionary.new
|
|
2942
|
+
seen[self] = duplicate
|
|
2943
|
+
|
|
2944
|
+
raw.each do |key, value|
|
|
2945
|
+
duplicate.code_set(
|
|
2946
|
+
key.code_deep_duplicate(seen),
|
|
2947
|
+
value.code_deep_duplicate(seen)
|
|
2948
|
+
)
|
|
2949
|
+
end
|
|
2950
|
+
|
|
2951
|
+
duplicate
|
|
1102
2952
|
end
|
|
1103
2953
|
|
|
1104
2954
|
def <=>(other)
|