code-ruby 3.1.2 → 4.0.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.
Files changed (98) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/bin/code +97 -20
  4. data/lib/code/concerns/shared.rb +331 -15
  5. data/lib/code/format.rb +15 -1
  6. data/lib/code/network.rb +87 -0
  7. data/lib/code/node/call.rb +79 -2
  8. data/lib/code/node/call_argument.rb +14 -0
  9. data/lib/code/node/code.rb +5 -4
  10. data/lib/code/node/function_parameter.rb +7 -4
  11. data/lib/code/node/list.rb +29 -1
  12. data/lib/code/object/base_64.rb +132 -6
  13. data/lib/code/object/boolean.rb +60 -0
  14. data/lib/code/object/class.rb +138 -2
  15. data/lib/code/object/code.rb +111 -3
  16. data/lib/code/object/context.rb +57 -1
  17. data/lib/code/object/cryptography.rb +63 -0
  18. data/lib/code/object/date.rb +13339 -462
  19. data/lib/code/object/decimal.rb +1725 -0
  20. data/lib/code/object/dictionary.rb +1790 -11
  21. data/lib/code/object/duration.rb +28 -0
  22. data/lib/code/object/function.rb +261 -23
  23. data/lib/code/object/global.rb +534 -1
  24. data/lib/code/object/html.rb +179 -7
  25. data/lib/code/object/http.rb +244 -14
  26. data/lib/code/object/ics.rb +75 -13
  27. data/lib/code/object/identifier_list.rb +17 -2
  28. data/lib/code/object/integer.rb +1937 -2
  29. data/lib/code/object/json.rb +75 -1
  30. data/lib/code/object/list.rb +3383 -10
  31. data/lib/code/object/nothing.rb +53 -0
  32. data/lib/code/object/number.rb +110 -0
  33. data/lib/code/object/parameter.rb +140 -0
  34. data/lib/code/object/range.rb +576 -14
  35. data/lib/code/object/smtp.rb +95 -12
  36. data/lib/code/object/string.rb +944 -3
  37. data/lib/code/object/super.rb +10 -1
  38. data/lib/code/object/time.rb +13358 -498
  39. data/lib/code/object/url.rb +65 -0
  40. data/lib/code/object.rb +543 -0
  41. data/lib/code/parser.rb +161 -24
  42. data/lib/code-ruby.rb +3 -0
  43. data/lib/code.rb +30 -3
  44. metadata +135 -84
  45. data/.github/dependabot.yml +0 -15
  46. data/.github/workflows/ci.yml +0 -38
  47. data/.gitignore +0 -30
  48. data/.node-version +0 -1
  49. data/.npm-version +0 -1
  50. data/.prettierignore +0 -2
  51. data/.rspec +0 -1
  52. data/.rubocop.yml +0 -140
  53. data/.ruby-version +0 -1
  54. data/.tool-versions +0 -3
  55. data/AGENTS.md +0 -43
  56. data/Gemfile +0 -22
  57. data/Gemfile.lock +0 -292
  58. data/Rakefile +0 -5
  59. data/bin/bundle +0 -123
  60. data/bin/bundle-audit +0 -31
  61. data/bin/bundler-audit +0 -31
  62. data/bin/dorian +0 -31
  63. data/bin/rspec +0 -31
  64. data/bin/rubocop +0 -31
  65. data/bin/test +0 -5
  66. data/code-ruby.gemspec +0 -34
  67. data/docs/precedence.txt +0 -36
  68. data/package-lock.json +0 -14
  69. data/package.json +0 -7
  70. data/spec/bin/code_spec.rb +0 -48
  71. data/spec/code/format_spec.rb +0 -153
  72. data/spec/code/node/call_spec.rb +0 -11
  73. data/spec/code/object/boolean_spec.rb +0 -18
  74. data/spec/code/object/cryptography_spec.rb +0 -25
  75. data/spec/code/object/decimal_spec.rb +0 -50
  76. data/spec/code/object/dictionary_spec.rb +0 -98
  77. data/spec/code/object/function_spec.rb +0 -268
  78. data/spec/code/object/http_spec.rb +0 -33
  79. data/spec/code/object/ics_spec.rb +0 -50
  80. data/spec/code/object/integer_spec.rb +0 -42
  81. data/spec/code/object/list_spec.rb +0 -22
  82. data/spec/code/object/nothing_spec.rb +0 -14
  83. data/spec/code/object/range_spec.rb +0 -23
  84. data/spec/code/object/string_spec.rb +0 -26
  85. data/spec/code/parser/boolean_spec.rb +0 -11
  86. data/spec/code/parser/chained_call_spec.rb +0 -16
  87. data/spec/code/parser/dictionary_spec.rb +0 -18
  88. data/spec/code/parser/function_spec.rb +0 -16
  89. data/spec/code/parser/group_spec.rb +0 -11
  90. data/spec/code/parser/if_modifier_spec.rb +0 -18
  91. data/spec/code/parser/list_spec.rb +0 -17
  92. data/spec/code/parser/number_spec.rb +0 -11
  93. data/spec/code/parser/string_spec.rb +0 -20
  94. data/spec/code/parser_spec.rb +0 -52
  95. data/spec/code/type_spec.rb +0 -21
  96. data/spec/code_spec.rb +0 -717
  97. data/spec/spec_helper.rb +0 -21
  98. data/spec/zeitwerk/loader_spec.rb +0 -7
@@ -3,6 +3,1698 @@
3
3
  class Code
4
4
  class Object
5
5
  class Integer < Number
6
+ CLASS_DOCUMENTATION = {
7
+ name: "Integer",
8
+ description: "represents whole numbers with arithmetic, bitwise operations, iteration, duration helpers, and numeric predicates.",
9
+ examples: [
10
+ "Integer.new(1)",
11
+ "12.digits",
12
+ "3.times((i) => { i })"
13
+ ]
14
+ }.freeze
15
+ INSTANCE_FUNCTIONS = {
16
+ "%" => {
17
+ name: "%",
18
+ description: "returns the integer modulo another number.",
19
+ examples: [
20
+ "5 % 2",
21
+ "4 % 2",
22
+ "7 % 3"
23
+ ]
24
+ },
25
+ "modulo" => {
26
+ name: "modulo",
27
+ description: "returns the integer modulo another number.",
28
+ examples: [
29
+ "5.modulo(2)",
30
+ "4.modulo(2)",
31
+ "7.modulo(3)"
32
+ ]
33
+ },
34
+ "&" => {
35
+ name: "&",
36
+ description: "returns the bitwise and of the integer and another number.",
37
+ examples: [
38
+ "5 & 3",
39
+ "4 & 1",
40
+ "7 & 2"
41
+ ]
42
+ },
43
+ "bitwise_and" => {
44
+ name: "bitwise_and",
45
+ description: "returns the bitwise and of the integer and another number.",
46
+ examples: [
47
+ "5.bitwise_and(3)",
48
+ "4.bitwise_and(1)",
49
+ "7.bitwise_and(2)"
50
+ ]
51
+ },
52
+ "*" => {
53
+ name: "*",
54
+ description: "multiplies numbers or repeats text by the integer.",
55
+ examples: [
56
+ "2 * 3",
57
+ "2 * 3.5",
58
+ "3 * :ha"
59
+ ]
60
+ },
61
+ "multiplication" => {
62
+ name: "multiplication",
63
+ description: "multiplies numbers or repeats text by the integer.",
64
+ examples: [
65
+ "2.multiplication(3)",
66
+ "2.multiplication(3.5)",
67
+ "3.multiplication(:ha)"
68
+ ]
69
+ },
70
+ "×" => {
71
+ name: "×",
72
+ description: "multiplies numbers or repeats text by the integer.",
73
+ examples: [
74
+ "2 × 3",
75
+ "2 × 3.5",
76
+ "3 × :ha"
77
+ ]
78
+ },
79
+ "**" => {
80
+ name: "**",
81
+ description: "returns the integer raised to a power.",
82
+ examples: [
83
+ "2 ** 3",
84
+ "4 ** 2",
85
+ "9 ** 0.5"
86
+ ]
87
+ },
88
+ "power" => {
89
+ name: "power",
90
+ description: "returns the integer raised to a power.",
91
+ examples: [
92
+ "2.power(3)",
93
+ "4.power(2)",
94
+ "9.power(0.5)"
95
+ ]
96
+ },
97
+ "power_modulo" => {
98
+ name: "power_modulo",
99
+ description: "returns modular exponentiation.",
100
+ examples: [
101
+ "2.power_modulo(3, 5)",
102
+ "3.power_modulo(2, 7)",
103
+ "10.power_modulo(2, 6)"
104
+ ]
105
+ },
106
+ "+" => {
107
+ name: "+",
108
+ description: "returns the integer itself when unary, adds numbers, or joins other values as text.",
109
+ examples: [
110
+ "1 + 2",
111
+ "1 + 2.5",
112
+ "+1"
113
+ ]
114
+ },
115
+ "plus" => {
116
+ name: "plus",
117
+ description: "adds numbers or joins non-numeric values as text.",
118
+ examples: [
119
+ "1.plus(2)",
120
+ "1.plus(2.5)",
121
+ "1.plus(:x)"
122
+ ]
123
+ },
124
+ "-" => {
125
+ name: "-",
126
+ description: "returns the integer negated when unary or minus another number.",
127
+ examples: [
128
+ "5 - 1",
129
+ "5 - 2.5",
130
+ "-5"
131
+ ]
132
+ },
133
+ "minus" => {
134
+ name: "minus",
135
+ description: "returns the integer minus another number.",
136
+ examples: [
137
+ "5.minus(1)",
138
+ "5.minus(2.5)",
139
+ "1.minus(3)"
140
+ ]
141
+ },
142
+ "unary_minus" => {
143
+ name: "unary_minus",
144
+ description: "returns the negated integer.",
145
+ examples: [
146
+ "5.unary_minus",
147
+ "0.unary_minus",
148
+ "-5.unary_minus"
149
+ ]
150
+ },
151
+ "/" => {
152
+ name: "/",
153
+ description: "returns the integer divided by another number as a decimal.",
154
+ examples: [
155
+ "5 / 2",
156
+ "4 / 2",
157
+ "7 / 3"
158
+ ]
159
+ },
160
+ "division" => {
161
+ name: "division",
162
+ description: "returns the integer divided by another number as a decimal.",
163
+ examples: [
164
+ "5.division(2)",
165
+ "4.division(2)",
166
+ "7.division(3)"
167
+ ]
168
+ },
169
+ "÷" => {
170
+ name: "÷",
171
+ description: "returns the integer divided by another number as a decimal.",
172
+ examples: [
173
+ "5 ÷ 2",
174
+ "4 ÷ 2",
175
+ "7 ÷ 3"
176
+ ]
177
+ },
178
+ "decimal_divide" => {
179
+ name: "decimal_divide",
180
+ description: "returns the integer divided by another number as a decimal.",
181
+ examples: [
182
+ "5.decimal_divide(2)",
183
+ "4.decimal_divide(2)",
184
+ "7.decimal_divide(3)"
185
+ ]
186
+ },
187
+ "digits" => {
188
+ name: "digits",
189
+ description: "returns the integer digits in reverse order, optionally for a base.",
190
+ examples: [
191
+ "123.digits",
192
+ "123.digits(10)",
193
+ "10.digits(2)"
194
+ ]
195
+ },
196
+ "bit_length" => {
197
+ name: "bit_length",
198
+ description: "returns the number of bits needed to represent the integer.",
199
+ examples: [
200
+ "5.bit_length",
201
+ "0.bit_length",
202
+ "255.bit_length"
203
+ ]
204
+ },
205
+ "all_bits?" => {
206
+ name: "all_bits?",
207
+ description: "returns whether every bit in a mask is set.",
208
+ examples: [
209
+ "7.all_bits?(3)",
210
+ "4.all_bits?(3)",
211
+ "0.all_bits?(1)"
212
+ ]
213
+ },
214
+ "any_bits?" => {
215
+ name: "any_bits?",
216
+ description: "returns whether any bit in a mask is set.",
217
+ examples: [
218
+ "5.any_bits?(1)",
219
+ "4.any_bits?(1)",
220
+ "0.any_bits?(1)"
221
+ ]
222
+ },
223
+ "no_bits?" => {
224
+ name: "no_bits?",
225
+ description: "returns whether no bits in a mask are set.",
226
+ examples: [
227
+ "4.no_bits?(1)",
228
+ "5.no_bits?(1)",
229
+ "0.no_bits?(1)"
230
+ ]
231
+ },
232
+ "character" => {
233
+ name: "character",
234
+ description: "returns the character for the integer codepoint.",
235
+ examples: [
236
+ "65.character",
237
+ "97.character",
238
+ "48.character"
239
+ ]
240
+ },
241
+ "greatest_common_denominator" => {
242
+ name: "greatest_common_denominator",
243
+ description: "returns the greatest common divisor with another integer.",
244
+ examples: [
245
+ "12.greatest_common_denominator(8)",
246
+ "21.greatest_common_denominator(14)",
247
+ "5.greatest_common_denominator(2)"
248
+ ]
249
+ },
250
+ "lowest_common_multiple" => {
251
+ name: "lowest_common_multiple",
252
+ description: "returns the least common multiple with another integer.",
253
+ examples: [
254
+ "4.lowest_common_multiple(6)",
255
+ "3.lowest_common_multiple(7)",
256
+ "5.lowest_common_multiple(10)"
257
+ ]
258
+ },
259
+ "<<" => {
260
+ name: "<<",
261
+ description: "returns the integer shifted left by a bit count.",
262
+ examples: [
263
+ "5 << 1",
264
+ "4 << 2",
265
+ "1 << 3"
266
+ ]
267
+ },
268
+ "left_shift" => {
269
+ name: "left_shift",
270
+ description: "returns the integer shifted left by a bit count.",
271
+ examples: [
272
+ "5.left_shift(1)",
273
+ "4.left_shift(2)",
274
+ "1.left_shift(3)"
275
+ ]
276
+ },
277
+ ">>" => {
278
+ name: ">>",
279
+ description: "returns the integer shifted right by a bit count.",
280
+ examples: [
281
+ "5 >> 1",
282
+ "4 >> 1",
283
+ "8 >> 2"
284
+ ]
285
+ },
286
+ "right_shift" => {
287
+ name: "right_shift",
288
+ description: "returns the integer shifted right by a bit count.",
289
+ examples: [
290
+ "5.right_shift(1)",
291
+ "4.right_shift(1)",
292
+ "8.right_shift(2)"
293
+ ]
294
+ },
295
+ "^" => {
296
+ name: "^",
297
+ description: "returns the bitwise xor of the integer and another number.",
298
+ examples: [
299
+ "5 ^ 3",
300
+ "4 ^ 1",
301
+ "7 ^ 2"
302
+ ]
303
+ },
304
+ "bitwise_xor" => {
305
+ name: "bitwise_xor",
306
+ description: "returns the bitwise xor of the integer and another number.",
307
+ examples: [
308
+ "5.bitwise_xor(3)",
309
+ "4.bitwise_xor(1)",
310
+ "7.bitwise_xor(2)"
311
+ ]
312
+ },
313
+ "abs" => {
314
+ name: "abs",
315
+ description: "returns the absolute value of the integer.",
316
+ examples: [
317
+ "-1.abs",
318
+ "1.abs",
319
+ "0.abs"
320
+ ]
321
+ },
322
+ "between?" => {
323
+ name: "between?",
324
+ description: "returns whether the integer is between two bounds.",
325
+ examples: [
326
+ "2.between?(1, 3)",
327
+ "4.between?(1, 3)",
328
+ "1.between?(1, 3)"
329
+ ]
330
+ },
331
+ "clamp" => {
332
+ name: "clamp",
333
+ description: "returns the integer constrained between two bounds.",
334
+ examples: [
335
+ "5.clamp(1, 3)",
336
+ "0.clamp(1, 3)",
337
+ "2.clamp(1, 3)"
338
+ ]
339
+ },
340
+ "divide" => {
341
+ name: "divide",
342
+ description: "returns integer division of the integer by another number.",
343
+ examples: [
344
+ "5.divide(2)",
345
+ "10.divide(3)",
346
+ "9.divide(2)"
347
+ ]
348
+ },
349
+ "divide_modulo" => {
350
+ name: "divide_modulo",
351
+ description: "returns integer division and modulo results as a list.",
352
+ examples: [
353
+ "5.divide_modulo(2)",
354
+ "10.divide_modulo(3)",
355
+ "9.divide_modulo(2)"
356
+ ]
357
+ },
358
+ "ceil" => {
359
+ name: "ceil",
360
+ description: "returns the integer rounded toward positive infinity at an optional precision.",
361
+ examples: [
362
+ "12.ceil",
363
+ "123.ceil(-1)",
364
+ "-123.ceil(-1)"
365
+ ]
366
+ },
367
+ "ceil_divide" => {
368
+ name: "ceil_divide",
369
+ description: "returns division by another number rounded up to an integer.",
370
+ examples: [
371
+ "5.ceil_divide(2)",
372
+ "4.ceil_divide(2)",
373
+ "7.ceil_divide(3)"
374
+ ]
375
+ },
376
+ "day" => {
377
+ name: "day",
378
+ description: "returns a duration of this many days.",
379
+ examples: [
380
+ "1.day",
381
+ "2.day",
382
+ "0.day"
383
+ ]
384
+ },
385
+ "days" => {
386
+ name: "days",
387
+ description: "returns a duration of this many days.",
388
+ examples: [
389
+ "1.days",
390
+ "2.days",
391
+ "0.days"
392
+ ]
393
+ },
394
+ "decrement!" => {
395
+ name: "decrement!",
396
+ description: "subtracts a value from the integer in place and returns it.",
397
+ examples: [
398
+ "i = 2 i.decrement!",
399
+ "i = 2 i.decrement!(2)",
400
+ "i = 0 i.decrement!"
401
+ ]
402
+ },
403
+ "decrement" => {
404
+ name: "decrement",
405
+ description: "returns the integer minus a value, defaulting to one.",
406
+ examples: [
407
+ "2.decrement",
408
+ "2.decrement(2)",
409
+ "0.decrement"
410
+ ]
411
+ },
412
+ "even?" => {
413
+ name: "even?",
414
+ description: "returns whether the integer is even.",
415
+ examples: [
416
+ "2.even?",
417
+ "1.even?",
418
+ "0.even?"
419
+ ]
420
+ },
421
+ "floor" => {
422
+ name: "floor",
423
+ description: "returns the integer rounded toward negative infinity at an optional precision.",
424
+ examples: [
425
+ "12.floor",
426
+ "123.floor(-1)",
427
+ "-123.floor(-1)"
428
+ ]
429
+ },
430
+ "hour" => {
431
+ name: "hour",
432
+ description: "returns a duration of this many hours.",
433
+ examples: [
434
+ "1.hour",
435
+ "2.hour",
436
+ "0.hour"
437
+ ]
438
+ },
439
+ "hours" => {
440
+ name: "hours",
441
+ description: "returns a duration of this many hours.",
442
+ examples: [
443
+ "1.hours",
444
+ "2.hours",
445
+ "0.hours"
446
+ ]
447
+ },
448
+ "increment!" => {
449
+ name: "increment!",
450
+ description: "adds a value to the integer in place and returns it.",
451
+ examples: [
452
+ "i = 1 i.increment!",
453
+ "i = 1 i.increment!(2)",
454
+ "i = 0 i.increment!"
455
+ ]
456
+ },
457
+ "increment" => {
458
+ name: "increment",
459
+ description: "returns the integer plus a value, defaulting to one.",
460
+ examples: [
461
+ "1.increment",
462
+ "1.increment(2)",
463
+ "0.increment"
464
+ ]
465
+ },
466
+ "odd?" => {
467
+ name: "odd?",
468
+ description: "returns whether the integer is odd.",
469
+ examples: [
470
+ "1.odd?",
471
+ "2.odd?",
472
+ "0.odd?"
473
+ ]
474
+ },
475
+ "minute" => {
476
+ name: "minute",
477
+ description: "returns a duration of this many minutes.",
478
+ examples: [
479
+ "1.minute",
480
+ "2.minute",
481
+ "0.minute"
482
+ ]
483
+ },
484
+ "minutes" => {
485
+ name: "minutes",
486
+ description: "returns a duration of this many minutes.",
487
+ examples: [
488
+ "1.minutes",
489
+ "2.minutes",
490
+ "0.minutes"
491
+ ]
492
+ },
493
+ "month" => {
494
+ name: "month",
495
+ description: "returns a duration of this many months.",
496
+ examples: [
497
+ "1.month",
498
+ "2.month",
499
+ "0.month"
500
+ ]
501
+ },
502
+ "months" => {
503
+ name: "months",
504
+ description: "returns a duration of this many months.",
505
+ examples: [
506
+ "1.months",
507
+ "2.months",
508
+ "0.months"
509
+ ]
510
+ },
511
+ "round" => {
512
+ name: "round",
513
+ description: "returns the integer rounded to a precision.",
514
+ examples: [
515
+ "12.round",
516
+ "123.round(-1)",
517
+ "-123.round(-1)"
518
+ ]
519
+ },
520
+ "second" => {
521
+ name: "second",
522
+ description: "returns a duration of this many seconds.",
523
+ examples: [
524
+ "1.second",
525
+ "2.second",
526
+ "0.second"
527
+ ]
528
+ },
529
+ "seconds" => {
530
+ name: "seconds",
531
+ description: "returns a duration of this many seconds.",
532
+ examples: [
533
+ "1.seconds",
534
+ "2.seconds",
535
+ "0.seconds"
536
+ ]
537
+ },
538
+ "sqrt" => {
539
+ name: "sqrt",
540
+ description: "returns the square root of the integer.",
541
+ examples: [
542
+ "4.sqrt",
543
+ "9.sqrt",
544
+ "2.sqrt"
545
+ ]
546
+ },
547
+ "times" => {
548
+ name: "times",
549
+ description: "calls a function once for each number from zero up to the integer and returns the integer.",
550
+ examples: [
551
+ "3.times((i) => { i })",
552
+ "0.times((i) => { i })",
553
+ "2.times((i, count) => { count })"
554
+ ]
555
+ },
556
+ "down_to" => {
557
+ name: "down_to",
558
+ description: "calls a function for each integer from this value down to a target and returns the integer.",
559
+ examples: [
560
+ "3.down_to(1, (i) => { i })",
561
+ "3.down_to(1, (i, index) => { index })",
562
+ "1.down_to(1, (i) => { i })"
563
+ ]
564
+ },
565
+ "up_to" => {
566
+ name: "up_to",
567
+ description: "calls a function for each integer from this value up to a target and returns the integer.",
568
+ examples: [
569
+ "1.up_to(3, (i) => { i })",
570
+ "1.up_to(3, (i, index) => { index })",
571
+ "1.up_to(1, (i) => { i })"
572
+ ]
573
+ },
574
+ "truncate" => {
575
+ name: "truncate",
576
+ description: "returns the integer truncated to a precision.",
577
+ examples: [
578
+ "12.truncate",
579
+ "123.truncate(-1)",
580
+ "-123.truncate(-1)"
581
+ ]
582
+ },
583
+ "week" => {
584
+ name: "week",
585
+ description: "returns a duration of this many weeks.",
586
+ examples: [
587
+ "1.week",
588
+ "2.week",
589
+ "0.week"
590
+ ]
591
+ },
592
+ "weeks" => {
593
+ name: "weeks",
594
+ description: "returns a duration of this many weeks.",
595
+ examples: [
596
+ "1.weeks",
597
+ "2.weeks",
598
+ "0.weeks"
599
+ ]
600
+ },
601
+ "year" => {
602
+ name: "year",
603
+ description: "returns a duration of this many years.",
604
+ examples: [
605
+ "1.year",
606
+ "2.year",
607
+ "0.year"
608
+ ]
609
+ },
610
+ "years" => {
611
+ name: "years",
612
+ description: "returns a duration of this many years.",
613
+ examples: [
614
+ "1.years",
615
+ "2.years",
616
+ "0.years"
617
+ ]
618
+ },
619
+ "|" => {
620
+ name: "|",
621
+ description: "returns the bitwise or of the integer and another number.",
622
+ examples: [
623
+ "5 | 2",
624
+ "4 | 1",
625
+ "7 | 2"
626
+ ]
627
+ },
628
+ "bitwise_or" => {
629
+ name: "bitwise_or",
630
+ description: "returns the bitwise or of the integer and another number.",
631
+ examples: [
632
+ "5.bitwise_or(2)",
633
+ "4.bitwise_or(1)",
634
+ "7.bitwise_or(2)"
635
+ ]
636
+ },
637
+ "many?" => {
638
+ name: "many?",
639
+ description: "returns whether the integer is greater than one.",
640
+ examples: [
641
+ "2.many?",
642
+ "1.many?",
643
+ "0.many?"
644
+ ]
645
+ },
646
+ "any?" => {
647
+ name: "any?",
648
+ description: "returns whether the integer is greater than zero.",
649
+ examples: [
650
+ "1.any?",
651
+ "0.any?",
652
+ "-1.any?"
653
+ ]
654
+ },
655
+ "positive?" => {
656
+ name: "positive?",
657
+ description: "returns whether the integer is positive.",
658
+ examples: [
659
+ "1.positive?",
660
+ "0.positive?",
661
+ "-1.positive?"
662
+ ]
663
+ },
664
+ "negative?" => {
665
+ name: "negative?",
666
+ description: "returns whether the integer is negative.",
667
+ examples: [
668
+ "-1.negative?",
669
+ "0.negative?",
670
+ "1.negative?"
671
+ ]
672
+ },
673
+ "next" => {
674
+ name: "next",
675
+ description: "returns the integer plus one.",
676
+ examples: [
677
+ "1.next",
678
+ "0.next",
679
+ "-1.next"
680
+ ]
681
+ },
682
+ "successor" => {
683
+ name: "successor",
684
+ description: "returns the integer plus one.",
685
+ examples: [
686
+ "1.successor",
687
+ "0.successor",
688
+ "-1.successor"
689
+ ]
690
+ },
691
+ "previous" => {
692
+ name: "previous",
693
+ description: "returns the integer minus one.",
694
+ examples: [
695
+ "1.previous",
696
+ "0.previous",
697
+ "-1.previous"
698
+ ]
699
+ },
700
+ "predecessor" => {
701
+ name: "predecessor",
702
+ description: "returns the integer minus one.",
703
+ examples: [
704
+ "1.predecessor",
705
+ "0.predecessor",
706
+ "-1.predecessor"
707
+ ]
708
+ },
709
+ "remainder" => {
710
+ name: "remainder",
711
+ description: "returns the remainder after division by another number.",
712
+ examples: [
713
+ "5.remainder(2)",
714
+ "10.remainder(3)",
715
+ "9.remainder(2)"
716
+ ]
717
+ },
718
+ "non_zero?" => {
719
+ name: "non_zero?",
720
+ description: "returns whether the integer is not zero.",
721
+ examples: [
722
+ "1.non_zero?",
723
+ "0.non_zero?",
724
+ "-1.non_zero?"
725
+ ]
726
+ },
727
+ "integer?" => {
728
+ name: "integer?",
729
+ description: "returns whether the value is an integer.",
730
+ examples: [
731
+ "1.integer?",
732
+ "0.integer?",
733
+ "-1.integer?"
734
+ ]
735
+ },
736
+ "finite?" => {
737
+ name: "finite?",
738
+ description: "returns whether the integer is finite.",
739
+ examples: [
740
+ "1.finite?",
741
+ "0.finite?",
742
+ "-1.finite?"
743
+ ]
744
+ },
745
+ "infinite?" => {
746
+ name: "infinite?",
747
+ description: "returns whether the integer is infinite.",
748
+ examples: [
749
+ "1.infinite?",
750
+ "0.infinite?",
751
+ "-1.infinite?"
752
+ ]
753
+ },
754
+ "numerator" => {
755
+ name: "numerator",
756
+ description: "returns the integer numerator.",
757
+ examples: [
758
+ "1.numerator",
759
+ "0.numerator",
760
+ "-1.numerator"
761
+ ]
762
+ },
763
+ "denominator" => {
764
+ name: "denominator",
765
+ description: "returns one as the integer denominator.",
766
+ examples: [
767
+ "1.denominator",
768
+ "0.denominator",
769
+ "-1.denominator"
770
+ ]
771
+ },
772
+ "magnitude" => {
773
+ name: "magnitude",
774
+ description: "returns the absolute value of the integer.",
775
+ examples: [
776
+ "-1.magnitude",
777
+ "1.magnitude",
778
+ "0.magnitude"
779
+ ]
780
+ },
781
+ "zero?" => {
782
+ name: "zero?",
783
+ description: "returns whether the integer is zero.",
784
+ examples: [
785
+ "0.zero?",
786
+ "1.zero?",
787
+ "-1.zero?"
788
+ ]
789
+ },
790
+ "one?" => {
791
+ name: "one?",
792
+ description: "returns whether the integer is one.",
793
+ examples: [
794
+ "1.one?",
795
+ "2.one?",
796
+ "0.one?"
797
+ ]
798
+ },
799
+ "two?" => {
800
+ name: "two?",
801
+ description: "returns whether the integer is two.",
802
+ examples: [
803
+ "2.two?",
804
+ "3.two?",
805
+ "0.two?"
806
+ ]
807
+ },
808
+ "three?" => {
809
+ name: "three?",
810
+ description: "returns whether the integer is three.",
811
+ examples: [
812
+ "3.three?",
813
+ "4.three?",
814
+ "0.three?"
815
+ ]
816
+ },
817
+ "four?" => {
818
+ name: "four?",
819
+ description: "returns whether the integer is four.",
820
+ examples: [
821
+ "4.four?",
822
+ "5.four?",
823
+ "0.four?"
824
+ ]
825
+ },
826
+ "five?" => {
827
+ name: "five?",
828
+ description: "returns whether the integer is five.",
829
+ examples: [
830
+ "5.five?",
831
+ "6.five?",
832
+ "0.five?"
833
+ ]
834
+ },
835
+ "six?" => {
836
+ name: "six?",
837
+ description: "returns whether the integer is six.",
838
+ examples: [
839
+ "6.six?",
840
+ "7.six?",
841
+ "0.six?"
842
+ ]
843
+ },
844
+ "seven?" => {
845
+ name: "seven?",
846
+ description: "returns whether the integer is seven.",
847
+ examples: [
848
+ "7.seven?",
849
+ "8.seven?",
850
+ "0.seven?"
851
+ ]
852
+ },
853
+ "eight?" => {
854
+ name: "eight?",
855
+ description: "returns whether the integer is eight.",
856
+ examples: [
857
+ "8.eight?",
858
+ "9.eight?",
859
+ "0.eight?"
860
+ ]
861
+ },
862
+ "nine?" => {
863
+ name: "nine?",
864
+ description: "returns whether the integer is nine.",
865
+ examples: [
866
+ "9.nine?",
867
+ "10.nine?",
868
+ "0.nine?"
869
+ ]
870
+ },
871
+ "ten?" => {
872
+ name: "ten?",
873
+ description: "returns whether the integer is ten.",
874
+ examples: [
875
+ "10.ten?",
876
+ "11.ten?",
877
+ "0.ten?"
878
+ ]
879
+ },
880
+ "eleven?" => {
881
+ name: "eleven?",
882
+ description: "returns whether the integer is eleven.",
883
+ examples: [
884
+ "11.eleven?",
885
+ "12.eleven?",
886
+ "0.eleven?"
887
+ ]
888
+ },
889
+ "twelve?" => {
890
+ name: "twelve?",
891
+ description: "returns whether the integer is twelve.",
892
+ examples: [
893
+ "12.twelve?",
894
+ "13.twelve?",
895
+ "0.twelve?"
896
+ ]
897
+ },
898
+ "thirteen?" => {
899
+ name: "thirteen?",
900
+ description: "returns whether the integer is thirteen.",
901
+ examples: [
902
+ "13.thirteen?",
903
+ "14.thirteen?",
904
+ "0.thirteen?"
905
+ ]
906
+ },
907
+ "fourteen?" => {
908
+ name: "fourteen?",
909
+ description: "returns whether the integer is fourteen.",
910
+ examples: [
911
+ "14.fourteen?",
912
+ "15.fourteen?",
913
+ "0.fourteen?"
914
+ ]
915
+ },
916
+ "fifteen?" => {
917
+ name: "fifteen?",
918
+ description: "returns whether the integer is fifteen.",
919
+ examples: [
920
+ "15.fifteen?",
921
+ "16.fifteen?",
922
+ "0.fifteen?"
923
+ ]
924
+ },
925
+ "sixteen?" => {
926
+ name: "sixteen?",
927
+ description: "returns whether the integer is sixteen.",
928
+ examples: [
929
+ "16.sixteen?",
930
+ "17.sixteen?",
931
+ "0.sixteen?"
932
+ ]
933
+ },
934
+ "seventeen?" => {
935
+ name: "seventeen?",
936
+ description: "returns whether the integer is seventeen.",
937
+ examples: [
938
+ "17.seventeen?",
939
+ "18.seventeen?",
940
+ "0.seventeen?"
941
+ ]
942
+ },
943
+ "eighteen?" => {
944
+ name: "eighteen?",
945
+ description: "returns whether the integer is eighteen.",
946
+ examples: [
947
+ "18.eighteen?",
948
+ "19.eighteen?",
949
+ "0.eighteen?"
950
+ ]
951
+ },
952
+ "nineteen?" => {
953
+ name: "nineteen?",
954
+ description: "returns whether the integer is nineteen.",
955
+ examples: [
956
+ "19.nineteen?",
957
+ "20.nineteen?",
958
+ "0.nineteen?"
959
+ ]
960
+ },
961
+ "twenty?" => {
962
+ name: "twenty?",
963
+ description: "returns whether the integer is twenty.",
964
+ examples: [
965
+ "20.twenty?",
966
+ "21.twenty?",
967
+ "0.twenty?"
968
+ ]
969
+ },
970
+ "twenty_one?" => {
971
+ name: "twenty_one?",
972
+ description: "returns whether the integer is twenty one.",
973
+ examples: [
974
+ "21.twenty_one?",
975
+ "22.twenty_one?",
976
+ "0.twenty_one?"
977
+ ]
978
+ },
979
+ "twenty_two?" => {
980
+ name: "twenty_two?",
981
+ description: "returns whether the integer is twenty two.",
982
+ examples: [
983
+ "22.twenty_two?",
984
+ "23.twenty_two?",
985
+ "0.twenty_two?"
986
+ ]
987
+ },
988
+ "twenty_three?" => {
989
+ name: "twenty_three?",
990
+ description: "returns whether the integer is twenty three.",
991
+ examples: [
992
+ "23.twenty_three?",
993
+ "24.twenty_three?",
994
+ "0.twenty_three?"
995
+ ]
996
+ },
997
+ "twenty_four?" => {
998
+ name: "twenty_four?",
999
+ description: "returns whether the integer is twenty four.",
1000
+ examples: [
1001
+ "24.twenty_four?",
1002
+ "25.twenty_four?",
1003
+ "0.twenty_four?"
1004
+ ]
1005
+ },
1006
+ "twenty_five?" => {
1007
+ name: "twenty_five?",
1008
+ description: "returns whether the integer is twenty five.",
1009
+ examples: [
1010
+ "25.twenty_five?",
1011
+ "26.twenty_five?",
1012
+ "0.twenty_five?"
1013
+ ]
1014
+ },
1015
+ "twenty_six?" => {
1016
+ name: "twenty_six?",
1017
+ description: "returns whether the integer is twenty six.",
1018
+ examples: [
1019
+ "26.twenty_six?",
1020
+ "27.twenty_six?",
1021
+ "0.twenty_six?"
1022
+ ]
1023
+ },
1024
+ "twenty_seven?" => {
1025
+ name: "twenty_seven?",
1026
+ description: "returns whether the integer is twenty seven.",
1027
+ examples: [
1028
+ "27.twenty_seven?",
1029
+ "28.twenty_seven?",
1030
+ "0.twenty_seven?"
1031
+ ]
1032
+ },
1033
+ "twenty_eight?" => {
1034
+ name: "twenty_eight?",
1035
+ description: "returns whether the integer is twenty eight.",
1036
+ examples: [
1037
+ "28.twenty_eight?",
1038
+ "29.twenty_eight?",
1039
+ "0.twenty_eight?"
1040
+ ]
1041
+ },
1042
+ "twenty_nine?" => {
1043
+ name: "twenty_nine?",
1044
+ description: "returns whether the integer is twenty nine.",
1045
+ examples: [
1046
+ "29.twenty_nine?",
1047
+ "30.twenty_nine?",
1048
+ "0.twenty_nine?"
1049
+ ]
1050
+ },
1051
+ "thirty?" => {
1052
+ name: "thirty?",
1053
+ description: "returns whether the integer is thirty.",
1054
+ examples: [
1055
+ "30.thirty?",
1056
+ "31.thirty?",
1057
+ "0.thirty?"
1058
+ ]
1059
+ },
1060
+ "thirty_one?" => {
1061
+ name: "thirty_one?",
1062
+ description: "returns whether the integer is thirty one.",
1063
+ examples: [
1064
+ "31.thirty_one?",
1065
+ "32.thirty_one?",
1066
+ "0.thirty_one?"
1067
+ ]
1068
+ },
1069
+ "thirty_two?" => {
1070
+ name: "thirty_two?",
1071
+ description: "returns whether the integer is thirty two.",
1072
+ examples: [
1073
+ "32.thirty_two?",
1074
+ "33.thirty_two?",
1075
+ "0.thirty_two?"
1076
+ ]
1077
+ },
1078
+ "thirty_three?" => {
1079
+ name: "thirty_three?",
1080
+ description: "returns whether the integer is thirty three.",
1081
+ examples: [
1082
+ "33.thirty_three?",
1083
+ "34.thirty_three?",
1084
+ "0.thirty_three?"
1085
+ ]
1086
+ },
1087
+ "thirty_four?" => {
1088
+ name: "thirty_four?",
1089
+ description: "returns whether the integer is thirty four.",
1090
+ examples: [
1091
+ "34.thirty_four?",
1092
+ "35.thirty_four?",
1093
+ "0.thirty_four?"
1094
+ ]
1095
+ },
1096
+ "thirty_five?" => {
1097
+ name: "thirty_five?",
1098
+ description: "returns whether the integer is thirty five.",
1099
+ examples: [
1100
+ "35.thirty_five?",
1101
+ "36.thirty_five?",
1102
+ "0.thirty_five?"
1103
+ ]
1104
+ },
1105
+ "thirty_six?" => {
1106
+ name: "thirty_six?",
1107
+ description: "returns whether the integer is thirty six.",
1108
+ examples: [
1109
+ "36.thirty_six?",
1110
+ "37.thirty_six?",
1111
+ "0.thirty_six?"
1112
+ ]
1113
+ },
1114
+ "thirty_seven?" => {
1115
+ name: "thirty_seven?",
1116
+ description: "returns whether the integer is thirty seven.",
1117
+ examples: [
1118
+ "37.thirty_seven?",
1119
+ "38.thirty_seven?",
1120
+ "0.thirty_seven?"
1121
+ ]
1122
+ },
1123
+ "thirty_eight?" => {
1124
+ name: "thirty_eight?",
1125
+ description: "returns whether the integer is thirty eight.",
1126
+ examples: [
1127
+ "38.thirty_eight?",
1128
+ "39.thirty_eight?",
1129
+ "0.thirty_eight?"
1130
+ ]
1131
+ },
1132
+ "thirty_nine?" => {
1133
+ name: "thirty_nine?",
1134
+ description: "returns whether the integer is thirty nine.",
1135
+ examples: [
1136
+ "39.thirty_nine?",
1137
+ "40.thirty_nine?",
1138
+ "0.thirty_nine?"
1139
+ ]
1140
+ },
1141
+ "forty?" => {
1142
+ name: "forty?",
1143
+ description: "returns whether the integer is forty.",
1144
+ examples: [
1145
+ "40.forty?",
1146
+ "41.forty?",
1147
+ "0.forty?"
1148
+ ]
1149
+ },
1150
+ "forty_one?" => {
1151
+ name: "forty_one?",
1152
+ description: "returns whether the integer is forty one.",
1153
+ examples: [
1154
+ "41.forty_one?",
1155
+ "42.forty_one?",
1156
+ "0.forty_one?"
1157
+ ]
1158
+ },
1159
+ "forty_two?" => {
1160
+ name: "forty_two?",
1161
+ description: "returns whether the integer is forty two.",
1162
+ examples: [
1163
+ "42.forty_two?",
1164
+ "43.forty_two?",
1165
+ "0.forty_two?"
1166
+ ]
1167
+ },
1168
+ "forty_three?" => {
1169
+ name: "forty_three?",
1170
+ description: "returns whether the integer is forty three.",
1171
+ examples: [
1172
+ "43.forty_three?",
1173
+ "44.forty_three?",
1174
+ "0.forty_three?"
1175
+ ]
1176
+ },
1177
+ "forty_four?" => {
1178
+ name: "forty_four?",
1179
+ description: "returns whether the integer is forty four.",
1180
+ examples: [
1181
+ "44.forty_four?",
1182
+ "45.forty_four?",
1183
+ "0.forty_four?"
1184
+ ]
1185
+ },
1186
+ "forty_five?" => {
1187
+ name: "forty_five?",
1188
+ description: "returns whether the integer is forty five.",
1189
+ examples: [
1190
+ "45.forty_five?",
1191
+ "46.forty_five?",
1192
+ "0.forty_five?"
1193
+ ]
1194
+ },
1195
+ "forty_six?" => {
1196
+ name: "forty_six?",
1197
+ description: "returns whether the integer is forty six.",
1198
+ examples: [
1199
+ "46.forty_six?",
1200
+ "47.forty_six?",
1201
+ "0.forty_six?"
1202
+ ]
1203
+ },
1204
+ "forty_seven?" => {
1205
+ name: "forty_seven?",
1206
+ description: "returns whether the integer is forty seven.",
1207
+ examples: [
1208
+ "47.forty_seven?",
1209
+ "48.forty_seven?",
1210
+ "0.forty_seven?"
1211
+ ]
1212
+ },
1213
+ "forty_eight?" => {
1214
+ name: "forty_eight?",
1215
+ description: "returns whether the integer is forty eight.",
1216
+ examples: [
1217
+ "48.forty_eight?",
1218
+ "49.forty_eight?",
1219
+ "0.forty_eight?"
1220
+ ]
1221
+ },
1222
+ "forty_nine?" => {
1223
+ name: "forty_nine?",
1224
+ description: "returns whether the integer is forty nine.",
1225
+ examples: [
1226
+ "49.forty_nine?",
1227
+ "50.forty_nine?",
1228
+ "0.forty_nine?"
1229
+ ]
1230
+ },
1231
+ "fifty?" => {
1232
+ name: "fifty?",
1233
+ description: "returns whether the integer is fifty.",
1234
+ examples: [
1235
+ "50.fifty?",
1236
+ "51.fifty?",
1237
+ "0.fifty?"
1238
+ ]
1239
+ },
1240
+ "fifty_one?" => {
1241
+ name: "fifty_one?",
1242
+ description: "returns whether the integer is fifty one.",
1243
+ examples: [
1244
+ "51.fifty_one?",
1245
+ "52.fifty_one?",
1246
+ "0.fifty_one?"
1247
+ ]
1248
+ },
1249
+ "fifty_two?" => {
1250
+ name: "fifty_two?",
1251
+ description: "returns whether the integer is fifty two.",
1252
+ examples: [
1253
+ "52.fifty_two?",
1254
+ "53.fifty_two?",
1255
+ "0.fifty_two?"
1256
+ ]
1257
+ },
1258
+ "fifty_three?" => {
1259
+ name: "fifty_three?",
1260
+ description: "returns whether the integer is fifty three.",
1261
+ examples: [
1262
+ "53.fifty_three?",
1263
+ "54.fifty_three?",
1264
+ "0.fifty_three?"
1265
+ ]
1266
+ },
1267
+ "fifty_four?" => {
1268
+ name: "fifty_four?",
1269
+ description: "returns whether the integer is fifty four.",
1270
+ examples: [
1271
+ "54.fifty_four?",
1272
+ "55.fifty_four?",
1273
+ "0.fifty_four?"
1274
+ ]
1275
+ },
1276
+ "fifty_five?" => {
1277
+ name: "fifty_five?",
1278
+ description: "returns whether the integer is fifty five.",
1279
+ examples: [
1280
+ "55.fifty_five?",
1281
+ "56.fifty_five?",
1282
+ "0.fifty_five?"
1283
+ ]
1284
+ },
1285
+ "fifty_six?" => {
1286
+ name: "fifty_six?",
1287
+ description: "returns whether the integer is fifty six.",
1288
+ examples: [
1289
+ "56.fifty_six?",
1290
+ "57.fifty_six?",
1291
+ "0.fifty_six?"
1292
+ ]
1293
+ },
1294
+ "fifty_seven?" => {
1295
+ name: "fifty_seven?",
1296
+ description: "returns whether the integer is fifty seven.",
1297
+ examples: [
1298
+ "57.fifty_seven?",
1299
+ "58.fifty_seven?",
1300
+ "0.fifty_seven?"
1301
+ ]
1302
+ },
1303
+ "fifty_eight?" => {
1304
+ name: "fifty_eight?",
1305
+ description: "returns whether the integer is fifty eight.",
1306
+ examples: [
1307
+ "58.fifty_eight?",
1308
+ "59.fifty_eight?",
1309
+ "0.fifty_eight?"
1310
+ ]
1311
+ },
1312
+ "fifty_nine?" => {
1313
+ name: "fifty_nine?",
1314
+ description: "returns whether the integer is fifty nine.",
1315
+ examples: [
1316
+ "59.fifty_nine?",
1317
+ "60.fifty_nine?",
1318
+ "0.fifty_nine?"
1319
+ ]
1320
+ },
1321
+ "sixty?" => {
1322
+ name: "sixty?",
1323
+ description: "returns whether the integer is sixty.",
1324
+ examples: [
1325
+ "60.sixty?",
1326
+ "61.sixty?",
1327
+ "0.sixty?"
1328
+ ]
1329
+ },
1330
+ "sixty_one?" => {
1331
+ name: "sixty_one?",
1332
+ description: "returns whether the integer is sixty one.",
1333
+ examples: [
1334
+ "61.sixty_one?",
1335
+ "62.sixty_one?",
1336
+ "0.sixty_one?"
1337
+ ]
1338
+ },
1339
+ "sixty_two?" => {
1340
+ name: "sixty_two?",
1341
+ description: "returns whether the integer is sixty two.",
1342
+ examples: [
1343
+ "62.sixty_two?",
1344
+ "63.sixty_two?",
1345
+ "0.sixty_two?"
1346
+ ]
1347
+ },
1348
+ "sixty_three?" => {
1349
+ name: "sixty_three?",
1350
+ description: "returns whether the integer is sixty three.",
1351
+ examples: [
1352
+ "63.sixty_three?",
1353
+ "64.sixty_three?",
1354
+ "0.sixty_three?"
1355
+ ]
1356
+ },
1357
+ "sixty_four?" => {
1358
+ name: "sixty_four?",
1359
+ description: "returns whether the integer is sixty four.",
1360
+ examples: [
1361
+ "64.sixty_four?",
1362
+ "65.sixty_four?",
1363
+ "0.sixty_four?"
1364
+ ]
1365
+ },
1366
+ "sixty_five?" => {
1367
+ name: "sixty_five?",
1368
+ description: "returns whether the integer is sixty five.",
1369
+ examples: [
1370
+ "65.sixty_five?",
1371
+ "66.sixty_five?",
1372
+ "0.sixty_five?"
1373
+ ]
1374
+ },
1375
+ "sixty_six?" => {
1376
+ name: "sixty_six?",
1377
+ description: "returns whether the integer is sixty six.",
1378
+ examples: [
1379
+ "66.sixty_six?",
1380
+ "67.sixty_six?",
1381
+ "0.sixty_six?"
1382
+ ]
1383
+ },
1384
+ "sixty_seven?" => {
1385
+ name: "sixty_seven?",
1386
+ description: "returns whether the integer is sixty seven.",
1387
+ examples: [
1388
+ "67.sixty_seven?",
1389
+ "68.sixty_seven?",
1390
+ "0.sixty_seven?"
1391
+ ]
1392
+ },
1393
+ "sixty_eight?" => {
1394
+ name: "sixty_eight?",
1395
+ description: "returns whether the integer is sixty eight.",
1396
+ examples: [
1397
+ "68.sixty_eight?",
1398
+ "69.sixty_eight?",
1399
+ "0.sixty_eight?"
1400
+ ]
1401
+ },
1402
+ "sixty_nine?" => {
1403
+ name: "sixty_nine?",
1404
+ description: "returns whether the integer is sixty nine.",
1405
+ examples: [
1406
+ "69.sixty_nine?",
1407
+ "70.sixty_nine?",
1408
+ "0.sixty_nine?"
1409
+ ]
1410
+ },
1411
+ "seventy?" => {
1412
+ name: "seventy?",
1413
+ description: "returns whether the integer is seventy.",
1414
+ examples: [
1415
+ "70.seventy?",
1416
+ "71.seventy?",
1417
+ "0.seventy?"
1418
+ ]
1419
+ },
1420
+ "seventy_one?" => {
1421
+ name: "seventy_one?",
1422
+ description: "returns whether the integer is seventy one.",
1423
+ examples: [
1424
+ "71.seventy_one?",
1425
+ "72.seventy_one?",
1426
+ "0.seventy_one?"
1427
+ ]
1428
+ },
1429
+ "seventy_two?" => {
1430
+ name: "seventy_two?",
1431
+ description: "returns whether the integer is seventy two.",
1432
+ examples: [
1433
+ "72.seventy_two?",
1434
+ "73.seventy_two?",
1435
+ "0.seventy_two?"
1436
+ ]
1437
+ },
1438
+ "seventy_three?" => {
1439
+ name: "seventy_three?",
1440
+ description: "returns whether the integer is seventy three.",
1441
+ examples: [
1442
+ "73.seventy_three?",
1443
+ "74.seventy_three?",
1444
+ "0.seventy_three?"
1445
+ ]
1446
+ },
1447
+ "seventy_four?" => {
1448
+ name: "seventy_four?",
1449
+ description: "returns whether the integer is seventy four.",
1450
+ examples: [
1451
+ "74.seventy_four?",
1452
+ "75.seventy_four?",
1453
+ "0.seventy_four?"
1454
+ ]
1455
+ },
1456
+ "seventy_five?" => {
1457
+ name: "seventy_five?",
1458
+ description: "returns whether the integer is seventy five.",
1459
+ examples: [
1460
+ "75.seventy_five?",
1461
+ "76.seventy_five?",
1462
+ "0.seventy_five?"
1463
+ ]
1464
+ },
1465
+ "seventy_six?" => {
1466
+ name: "seventy_six?",
1467
+ description: "returns whether the integer is seventy six.",
1468
+ examples: [
1469
+ "76.seventy_six?",
1470
+ "77.seventy_six?",
1471
+ "0.seventy_six?"
1472
+ ]
1473
+ },
1474
+ "seventy_seven?" => {
1475
+ name: "seventy_seven?",
1476
+ description: "returns whether the integer is seventy seven.",
1477
+ examples: [
1478
+ "77.seventy_seven?",
1479
+ "78.seventy_seven?",
1480
+ "0.seventy_seven?"
1481
+ ]
1482
+ },
1483
+ "seventy_eight?" => {
1484
+ name: "seventy_eight?",
1485
+ description: "returns whether the integer is seventy eight.",
1486
+ examples: [
1487
+ "78.seventy_eight?",
1488
+ "79.seventy_eight?",
1489
+ "0.seventy_eight?"
1490
+ ]
1491
+ },
1492
+ "seventy_nine?" => {
1493
+ name: "seventy_nine?",
1494
+ description: "returns whether the integer is seventy nine.",
1495
+ examples: [
1496
+ "79.seventy_nine?",
1497
+ "80.seventy_nine?",
1498
+ "0.seventy_nine?"
1499
+ ]
1500
+ },
1501
+ "eighty?" => {
1502
+ name: "eighty?",
1503
+ description: "returns whether the integer is eighty.",
1504
+ examples: [
1505
+ "80.eighty?",
1506
+ "81.eighty?",
1507
+ "0.eighty?"
1508
+ ]
1509
+ },
1510
+ "eighty_one?" => {
1511
+ name: "eighty_one?",
1512
+ description: "returns whether the integer is eighty one.",
1513
+ examples: [
1514
+ "81.eighty_one?",
1515
+ "82.eighty_one?",
1516
+ "0.eighty_one?"
1517
+ ]
1518
+ },
1519
+ "eighty_two?" => {
1520
+ name: "eighty_two?",
1521
+ description: "returns whether the integer is eighty two.",
1522
+ examples: [
1523
+ "82.eighty_two?",
1524
+ "83.eighty_two?",
1525
+ "0.eighty_two?"
1526
+ ]
1527
+ },
1528
+ "eighty_three?" => {
1529
+ name: "eighty_three?",
1530
+ description: "returns whether the integer is eighty three.",
1531
+ examples: [
1532
+ "83.eighty_three?",
1533
+ "84.eighty_three?",
1534
+ "0.eighty_three?"
1535
+ ]
1536
+ },
1537
+ "eighty_four?" => {
1538
+ name: "eighty_four?",
1539
+ description: "returns whether the integer is eighty four.",
1540
+ examples: [
1541
+ "84.eighty_four?",
1542
+ "85.eighty_four?",
1543
+ "0.eighty_four?"
1544
+ ]
1545
+ },
1546
+ "eighty_five?" => {
1547
+ name: "eighty_five?",
1548
+ description: "returns whether the integer is eighty five.",
1549
+ examples: [
1550
+ "85.eighty_five?",
1551
+ "86.eighty_five?",
1552
+ "0.eighty_five?"
1553
+ ]
1554
+ },
1555
+ "eighty_six?" => {
1556
+ name: "eighty_six?",
1557
+ description: "returns whether the integer is eighty six.",
1558
+ examples: [
1559
+ "86.eighty_six?",
1560
+ "87.eighty_six?",
1561
+ "0.eighty_six?"
1562
+ ]
1563
+ },
1564
+ "eighty_seven?" => {
1565
+ name: "eighty_seven?",
1566
+ description: "returns whether the integer is eighty seven.",
1567
+ examples: [
1568
+ "87.eighty_seven?",
1569
+ "88.eighty_seven?",
1570
+ "0.eighty_seven?"
1571
+ ]
1572
+ },
1573
+ "eighty_eight?" => {
1574
+ name: "eighty_eight?",
1575
+ description: "returns whether the integer is eighty eight.",
1576
+ examples: [
1577
+ "88.eighty_eight?",
1578
+ "89.eighty_eight?",
1579
+ "0.eighty_eight?"
1580
+ ]
1581
+ },
1582
+ "eighty_nine?" => {
1583
+ name: "eighty_nine?",
1584
+ description: "returns whether the integer is eighty nine.",
1585
+ examples: [
1586
+ "89.eighty_nine?",
1587
+ "90.eighty_nine?",
1588
+ "0.eighty_nine?"
1589
+ ]
1590
+ },
1591
+ "ninety?" => {
1592
+ name: "ninety?",
1593
+ description: "returns whether the integer is ninety.",
1594
+ examples: [
1595
+ "90.ninety?",
1596
+ "91.ninety?",
1597
+ "0.ninety?"
1598
+ ]
1599
+ },
1600
+ "ninety_one?" => {
1601
+ name: "ninety_one?",
1602
+ description: "returns whether the integer is ninety one.",
1603
+ examples: [
1604
+ "91.ninety_one?",
1605
+ "92.ninety_one?",
1606
+ "0.ninety_one?"
1607
+ ]
1608
+ },
1609
+ "ninety_two?" => {
1610
+ name: "ninety_two?",
1611
+ description: "returns whether the integer is ninety two.",
1612
+ examples: [
1613
+ "92.ninety_two?",
1614
+ "93.ninety_two?",
1615
+ "0.ninety_two?"
1616
+ ]
1617
+ },
1618
+ "ninety_three?" => {
1619
+ name: "ninety_three?",
1620
+ description: "returns whether the integer is ninety three.",
1621
+ examples: [
1622
+ "93.ninety_three?",
1623
+ "94.ninety_three?",
1624
+ "0.ninety_three?"
1625
+ ]
1626
+ },
1627
+ "ninety_four?" => {
1628
+ name: "ninety_four?",
1629
+ description: "returns whether the integer is ninety four.",
1630
+ examples: [
1631
+ "94.ninety_four?",
1632
+ "95.ninety_four?",
1633
+ "0.ninety_four?"
1634
+ ]
1635
+ },
1636
+ "ninety_five?" => {
1637
+ name: "ninety_five?",
1638
+ description: "returns whether the integer is ninety five.",
1639
+ examples: [
1640
+ "95.ninety_five?",
1641
+ "96.ninety_five?",
1642
+ "0.ninety_five?"
1643
+ ]
1644
+ },
1645
+ "ninety_six?" => {
1646
+ name: "ninety_six?",
1647
+ description: "returns whether the integer is ninety six.",
1648
+ examples: [
1649
+ "96.ninety_six?",
1650
+ "97.ninety_six?",
1651
+ "0.ninety_six?"
1652
+ ]
1653
+ },
1654
+ "ninety_seven?" => {
1655
+ name: "ninety_seven?",
1656
+ description: "returns whether the integer is ninety seven.",
1657
+ examples: [
1658
+ "97.ninety_seven?",
1659
+ "98.ninety_seven?",
1660
+ "0.ninety_seven?"
1661
+ ]
1662
+ },
1663
+ "ninety_eight?" => {
1664
+ name: "ninety_eight?",
1665
+ description: "returns whether the integer is ninety eight.",
1666
+ examples: [
1667
+ "98.ninety_eight?",
1668
+ "99.ninety_eight?",
1669
+ "0.ninety_eight?"
1670
+ ]
1671
+ },
1672
+ "ninety_nine?" => {
1673
+ name: "ninety_nine?",
1674
+ description: "returns whether the integer is ninety nine.",
1675
+ examples: [
1676
+ "99.ninety_nine?",
1677
+ "100.ninety_nine?",
1678
+ "0.ninety_nine?"
1679
+ ]
1680
+ },
1681
+ "one_hundred?" => {
1682
+ name: "one_hundred?",
1683
+ description: "returns whether the integer is one hundred.",
1684
+ examples: [
1685
+ "100.one_hundred?",
1686
+ "101.one_hundred?",
1687
+ "0.one_hundred?"
1688
+ ]
1689
+ }
1690
+ }.freeze
1691
+
1692
+ def self.function_documentation(scope)
1693
+ return INSTANCE_FUNCTIONS if scope == :instance
1694
+
1695
+ {}
1696
+ end
1697
+
6
1698
  def initialize(*args, **_kargs, &_block)
7
1699
  self.raw =
8
1700
  if args.first.class.in?(NUMBER_CLASSES)
@@ -37,6 +1729,9 @@ class Code
37
1729
  when "**", "power"
38
1730
  sig(args) { Integer | Decimal }
39
1731
  code_power(code_value)
1732
+ when "power_modulo"
1733
+ sig(args) { [Integer, Integer] }
1734
+ code_power_modulo(*code_arguments.raw)
40
1735
  when "+", "plus"
41
1736
  sig(args) { Object.maybe }
42
1737
  code_arguments.any? ? code_plus(code_value) : code_self
@@ -46,6 +1741,39 @@ class Code
46
1741
  when "/", "division", "÷"
47
1742
  sig(args) { Integer | Decimal }
48
1743
  code_division(code_value)
1744
+ when "divide"
1745
+ sig(args) { Integer | Decimal }
1746
+ code_divide(code_value)
1747
+ when "divide_modulo"
1748
+ sig(args) { Integer | Decimal }
1749
+ code_divide_modulo(code_value)
1750
+ when "decimal_divide"
1751
+ sig(args) { Integer | Decimal }
1752
+ code_decimal_divide(code_value)
1753
+ when "digits"
1754
+ sig(args) { Integer.maybe }
1755
+ code_digits(code_value)
1756
+ when "bit_length"
1757
+ sig(args)
1758
+ code_bit_length
1759
+ when "all_bits?"
1760
+ sig(args) { Integer }
1761
+ code_all_bits?(code_value)
1762
+ when "any_bits?"
1763
+ sig(args) { Integer }
1764
+ code_any_bits?(code_value)
1765
+ when "no_bits?"
1766
+ sig(args) { Integer }
1767
+ code_no_bits?(code_value)
1768
+ when "character"
1769
+ sig(args)
1770
+ code_character
1771
+ when "greatest_common_denominator"
1772
+ sig(args) { Integer }
1773
+ code_greatest_common_denominator(code_value)
1774
+ when "lowest_common_multiple"
1775
+ sig(args) { Integer }
1776
+ code_lowest_common_multiple(code_value)
49
1777
  when "<<", "left_shift"
50
1778
  sig(args) { Integer | Decimal }
51
1779
  code_left_shift(code_value)
@@ -58,9 +1786,18 @@ class Code
58
1786
  when "abs"
59
1787
  sig(args)
60
1788
  code_abs
1789
+ when "between?"
1790
+ sig(args) { [Integer | Decimal, Integer | Decimal] }
1791
+ code_between?(*code_arguments.raw)
61
1792
  when "ceil"
62
1793
  sig(args) { Integer.maybe }
63
1794
  code_ceil(code_value)
1795
+ when "ceil_divide"
1796
+ sig(args) { Integer | Decimal }
1797
+ code_ceil_divide(code_value)
1798
+ when "clamp"
1799
+ sig(args) { [Integer | Decimal, Integer | Decimal] }
1800
+ code_clamp(*code_arguments.raw)
64
1801
  when "day", "days"
65
1802
  sig(args)
66
1803
  code_days
@@ -88,18 +1825,48 @@ class Code
88
1825
  when "odd?"
89
1826
  sig(args)
90
1827
  code_odd?
1828
+ when "minute", "minutes"
1829
+ sig(args)
1830
+ code_minutes
1831
+ when "month", "months"
1832
+ sig(args)
1833
+ code_months
1834
+ when "next", "successor"
1835
+ sig(args)
1836
+ code_next
1837
+ when "previous", "predecessor"
1838
+ sig(args)
1839
+ code_previous
1840
+ when "remainder"
1841
+ sig(args) { Integer | Decimal }
1842
+ code_remainder(code_value)
91
1843
  when "round"
92
1844
  sig(args) { Integer.maybe }
93
1845
  code_round(code_value)
1846
+ when "second", "seconds"
1847
+ sig(args)
1848
+ code_seconds
94
1849
  when "sqrt"
95
1850
  sig(args)
96
1851
  code_sqrt
97
1852
  when "times"
98
1853
  sig(args) { Function }
99
1854
  code_times(code_value, **globals)
1855
+ when "down_to"
1856
+ sig(args) { [Integer, Function] }
1857
+ code_down_to(*code_arguments.raw, **globals)
1858
+ when "up_to"
1859
+ sig(args) { [Integer, Function] }
1860
+ code_up_to(*code_arguments.raw, **globals)
100
1861
  when "truncate"
101
1862
  sig(args) { Integer.maybe }
102
1863
  code_truncate(code_value)
1864
+ when "week", "weeks"
1865
+ sig(args)
1866
+ code_weeks
1867
+ when "year", "years"
1868
+ sig(args)
1869
+ code_years
103
1870
  when "|", "bitwise_or"
104
1871
  sig(args) { Integer | Decimal }
105
1872
  code_bitwise_or(code_value)
@@ -115,6 +1882,27 @@ class Code
115
1882
  when "negative?"
116
1883
  sig(args)
117
1884
  code_negative?
1885
+ when "non_zero?"
1886
+ sig(args)
1887
+ code_non_zero?
1888
+ when "integer?"
1889
+ sig(args)
1890
+ code_integer?
1891
+ when "finite?"
1892
+ sig(args)
1893
+ code_finite?
1894
+ when "infinite?"
1895
+ sig(args)
1896
+ code_infinite?
1897
+ when "numerator"
1898
+ sig(args)
1899
+ code_numerator
1900
+ when "denominator"
1901
+ sig(args)
1902
+ code_denominator
1903
+ when "magnitude"
1904
+ sig(args)
1905
+ code_magnitude
118
1906
  when "zero?"
119
1907
  sig(args)
120
1908
  code_zero?
@@ -442,12 +2230,40 @@ class Code
442
2230
  Integer.new(raw ^ code_other.raw.to_i)
443
2231
  end
444
2232
 
2233
+ def code_bit_length
2234
+ Integer.new(raw.bit_length)
2235
+ end
2236
+
2237
+ def code_all_bits?(mask)
2238
+ code_mask = mask.to_code
2239
+
2240
+ Boolean.new(raw.allbits?(code_mask.raw))
2241
+ end
2242
+
2243
+ def code_any_bits?(mask)
2244
+ code_mask = mask.to_code
2245
+
2246
+ Boolean.new(raw.anybits?(code_mask.raw))
2247
+ end
2248
+
2249
+ def code_no_bits?(mask)
2250
+ code_mask = mask.to_code
2251
+
2252
+ Boolean.new(raw.nobits?(code_mask.raw))
2253
+ end
2254
+
445
2255
  def code_ceil(n = nil)
446
2256
  code_n = n.to_code
447
2257
  code_n = Integer.new(0) if code_n.nothing?
448
2258
  Integer.new(raw.ceil(code_n.raw))
449
2259
  end
450
2260
 
2261
+ def code_ceil_divide(other)
2262
+ code_other = other.to_code
2263
+
2264
+ Integer.new(raw.ceildiv(code_other.raw))
2265
+ end
2266
+
451
2267
  def code_decrement!(n = nil)
452
2268
  code_n = n.to_code
453
2269
  code_n = Integer.new(1) if code_n.nothing?
@@ -466,6 +2282,24 @@ class Code
466
2282
  Decimal.new(BigDecimal(raw) / code_other.raw)
467
2283
  end
468
2284
 
2285
+ def code_decimal_divide(other)
2286
+ code_division(other)
2287
+ end
2288
+
2289
+ def code_digits(base = nil)
2290
+ code_base = base.to_code
2291
+
2292
+ if code_base.nothing?
2293
+ List.new(raw.digits)
2294
+ else
2295
+ List.new(raw.digits(code_base.raw))
2296
+ end
2297
+ end
2298
+
2299
+ def code_character
2300
+ String.new(raw.chr)
2301
+ end
2302
+
469
2303
  def code_even?
470
2304
  Boolean.new(raw.even?)
471
2305
  end
@@ -489,6 +2323,16 @@ class Code
489
2323
  Integer.new(raw + code_n.raw)
490
2324
  end
491
2325
 
2326
+ def code_greatest_common_denominator(other)
2327
+ code_other = other.to_code
2328
+ Integer.new(raw.gcd(code_other.raw))
2329
+ end
2330
+
2331
+ def code_lowest_common_multiple(other)
2332
+ code_other = other.to_code
2333
+ Integer.new(raw.lcm(code_other.raw))
2334
+ end
2335
+
492
2336
  def code_left_shift(other)
493
2337
  code_other = other.to_code
494
2338
  Integer.new(raw << code_other.raw.to_i)
@@ -546,12 +2390,19 @@ class Code
546
2390
  code_other = other.to_code
547
2391
 
548
2392
  if code_other.is_a?(Integer)
549
- Integer.new(raw**other.raw)
2393
+ Integer.new(raw**code_other.raw)
550
2394
  else
551
- Decimal.new(raw**other.raw)
2395
+ Decimal.new(raw**code_other.raw)
552
2396
  end
553
2397
  end
554
2398
 
2399
+ def code_power_modulo(power, modulo)
2400
+ code_power = power.to_code
2401
+ code_modulo = modulo.to_code
2402
+
2403
+ Integer.new(raw.pow(code_power.raw, code_modulo.raw))
2404
+ end
2405
+
555
2406
  def code_right_shift(other)
556
2407
  code_other = other.to_code
557
2408
  Integer.new(raw >> code_other.raw.to_i)
@@ -593,6 +2444,42 @@ class Code
593
2444
  e.code_value
594
2445
  end
595
2446
 
2447
+ def code_down_to(value, function, **globals)
2448
+ code_value = value.to_code
2449
+ code_function = function.to_code
2450
+
2451
+ raw.downto(code_value.raw).with_index do |element, index|
2452
+ code_function.call(
2453
+ arguments: List.new([Integer.new(element), Integer.new(index), self]),
2454
+ **globals
2455
+ )
2456
+ rescue Error::Next => e
2457
+ e.code_value
2458
+ end
2459
+
2460
+ self
2461
+ rescue Error::Break => e
2462
+ e.code_value
2463
+ end
2464
+
2465
+ def code_up_to(value, function, **globals)
2466
+ code_value = value.to_code
2467
+ code_function = function.to_code
2468
+
2469
+ raw.upto(code_value.raw).with_index do |element, index|
2470
+ code_function.call(
2471
+ arguments: List.new([Integer.new(element), Integer.new(index), self]),
2472
+ **globals
2473
+ )
2474
+ rescue Error::Next => e
2475
+ e.code_value
2476
+ end
2477
+
2478
+ self
2479
+ rescue Error::Break => e
2480
+ e.code_value
2481
+ end
2482
+
596
2483
  def code_truncate(n = nil)
597
2484
  code_n = n.to_code
598
2485
  code_n = Integer.new(0) if code_n.nothing?
@@ -616,6 +2503,26 @@ class Code
616
2503
  Duration.new(raw.hours)
617
2504
  end
618
2505
 
2506
+ def code_minutes
2507
+ Duration.new(raw.minutes)
2508
+ end
2509
+
2510
+ def code_months
2511
+ Duration.new(raw.months)
2512
+ end
2513
+
2514
+ def code_seconds
2515
+ Duration.new(raw.seconds)
2516
+ end
2517
+
2518
+ def code_weeks
2519
+ Duration.new(raw.weeks)
2520
+ end
2521
+
2522
+ def code_years
2523
+ Duration.new(raw.years)
2524
+ end
2525
+
619
2526
  def code_days
620
2527
  Duration.new(raw.days)
621
2528
  end
@@ -628,6 +2535,34 @@ class Code
628
2535
  Boolean.new(raw.negative?)
629
2536
  end
630
2537
 
2538
+ def code_non_zero?
2539
+ Boolean.new(!raw.zero?)
2540
+ end
2541
+
2542
+ def code_integer?
2543
+ Boolean.new(true)
2544
+ end
2545
+
2546
+ def code_finite?
2547
+ Boolean.new(true)
2548
+ end
2549
+
2550
+ def code_infinite?
2551
+ Boolean.new(false)
2552
+ end
2553
+
2554
+ def code_numerator
2555
+ Integer.new(raw.numerator)
2556
+ end
2557
+
2558
+ def code_denominator
2559
+ Integer.new(raw.denominator)
2560
+ end
2561
+
2562
+ def code_magnitude
2563
+ code_abs
2564
+ end
2565
+
631
2566
  def code_zero?
632
2567
  Boolean.new(raw.zero?)
633
2568
  end