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,1554 @@
3
3
  class Code
4
4
  class Object
5
5
  class Decimal < Number
6
+ CLASS_DOCUMENTATION = {
7
+ name: "Decimal",
8
+ description: "represents fractional numbers with arithmetic, rounding, formatting, duration helpers, and numeric predicates.",
9
+ examples: [
10
+ "Decimal.new(1.5)",
11
+ "Decimal.new(\"2.5\") + 1",
12
+ "1.5.days"
13
+ ]
14
+ }.freeze
15
+ INSTANCE_FUNCTIONS = {
16
+ "%" => {
17
+ name: "%",
18
+ description: "returns the decimal modulo another number.",
19
+ examples: [
20
+ "5.5 % 2",
21
+ "4.0 % 2",
22
+ "7.5 % 3"
23
+ ]
24
+ },
25
+ "modulo" => {
26
+ name: "modulo",
27
+ description: "returns the decimal modulo another number.",
28
+ examples: [
29
+ "5.5.modulo(2)",
30
+ "4.0.modulo(2)",
31
+ "7.5.modulo(3)"
32
+ ]
33
+ },
34
+ "&" => {
35
+ name: "&",
36
+ description: "returns the bitwise and of the decimal integer value and another number.",
37
+ examples: [
38
+ "5.5 & 3",
39
+ "4.0 & 1",
40
+ "7.0 & 2"
41
+ ]
42
+ },
43
+ "bitwise_and" => {
44
+ name: "bitwise_and",
45
+ description: "returns the bitwise and of the decimal integer value and another number.",
46
+ examples: [
47
+ "5.5.bitwise_and(3)",
48
+ "4.0.bitwise_and(1)",
49
+ "7.0.bitwise_and(2)"
50
+ ]
51
+ },
52
+ "*" => {
53
+ name: "*",
54
+ description: "returns the decimal multiplied by another number.",
55
+ examples: [
56
+ "2.5 * 2",
57
+ "1.5 * 3",
58
+ "4.0 * 2"
59
+ ]
60
+ },
61
+ "multiplication" => {
62
+ name: "multiplication",
63
+ description: "returns the decimal multiplied by another number.",
64
+ examples: [
65
+ "2.5.multiplication(2)",
66
+ "1.5.multiplication(3)",
67
+ "4.0.multiplication(2)"
68
+ ]
69
+ },
70
+ "**" => {
71
+ name: "**",
72
+ description: "returns the decimal raised to a power.",
73
+ examples: [
74
+ "2.5 ** 2",
75
+ "4.0 ** 2",
76
+ "9.0 ** 0.5"
77
+ ]
78
+ },
79
+ "power" => {
80
+ name: "power",
81
+ description: "returns the decimal raised to a power.",
82
+ examples: [
83
+ "2.5.power(2)",
84
+ "4.0.power(2)",
85
+ "9.0.power(0.5)"
86
+ ]
87
+ },
88
+ "+" => {
89
+ name: "+",
90
+ description: "returns the decimal itself when unary, adds numbers, or joins other values as text.",
91
+ examples: [
92
+ "1.5 + 2",
93
+ "1.5 + 2.5",
94
+ "+1.5"
95
+ ]
96
+ },
97
+ "plus" => {
98
+ name: "plus",
99
+ description: "adds numbers or joins non-numeric values as text.",
100
+ examples: [
101
+ "1.5.plus(2)",
102
+ "1.5.plus(2.5)",
103
+ "1.5.plus(:x)"
104
+ ]
105
+ },
106
+ "-" => {
107
+ name: "-",
108
+ description: "returns the decimal negated when unary or minus another number.",
109
+ examples: [
110
+ "5.5 - 1",
111
+ "5.5 - 2.5",
112
+ "-5.5"
113
+ ]
114
+ },
115
+ "minus" => {
116
+ name: "minus",
117
+ description: "returns the decimal minus another number.",
118
+ examples: [
119
+ "5.5.minus(1)",
120
+ "5.5.minus(2.5)",
121
+ "1.5.minus(3)"
122
+ ]
123
+ },
124
+ "/" => {
125
+ name: "/",
126
+ description: "returns the decimal divided by another number.",
127
+ examples: [
128
+ "5.5 / 2",
129
+ "4.0 / 2",
130
+ "7.5 / 3"
131
+ ]
132
+ },
133
+ "division" => {
134
+ name: "division",
135
+ description: "returns the decimal divided by another number.",
136
+ examples: [
137
+ "5.5.division(2)",
138
+ "4.0.division(2)",
139
+ "7.5.division(3)"
140
+ ]
141
+ },
142
+ "decimal_divide" => {
143
+ name: "decimal_divide",
144
+ description: "returns the decimal divided by another number.",
145
+ examples: [
146
+ "5.5.decimal_divide(2)",
147
+ "4.0.decimal_divide(2)",
148
+ "7.5.decimal_divide(3)"
149
+ ]
150
+ },
151
+ "<<" => {
152
+ name: "<<",
153
+ description: "returns the decimal integer value shifted left.",
154
+ examples: [
155
+ "5.5 << 1",
156
+ "4.0 << 2",
157
+ "1.0 << 3"
158
+ ]
159
+ },
160
+ "left_shift" => {
161
+ name: "left_shift",
162
+ description: "returns the decimal integer value shifted left.",
163
+ examples: [
164
+ "5.5.left_shift(1)",
165
+ "4.0.left_shift(2)",
166
+ "1.0.left_shift(3)"
167
+ ]
168
+ },
169
+ ">>" => {
170
+ name: ">>",
171
+ description: "returns the decimal integer value shifted right.",
172
+ examples: [
173
+ "5.5 >> 1",
174
+ "4.0 >> 1",
175
+ "8.0 >> 2"
176
+ ]
177
+ },
178
+ "right_shift" => {
179
+ name: "right_shift",
180
+ description: "returns the decimal integer value shifted right.",
181
+ examples: [
182
+ "5.5.right_shift(1)",
183
+ "4.0.right_shift(1)",
184
+ "8.0.right_shift(2)"
185
+ ]
186
+ },
187
+ "^" => {
188
+ name: "^",
189
+ description: "returns the bitwise xor of the decimal integer value and another number.",
190
+ examples: [
191
+ "5.5 ^ 3",
192
+ "4.0 ^ 1",
193
+ "7.0 ^ 2"
194
+ ]
195
+ },
196
+ "bitwise_xor" => {
197
+ name: "bitwise_xor",
198
+ description: "returns the bitwise xor of the decimal integer value and another number.",
199
+ examples: [
200
+ "5.5.bitwise_xor(3)",
201
+ "4.0.bitwise_xor(1)",
202
+ "7.0.bitwise_xor(2)"
203
+ ]
204
+ },
205
+ "abs" => {
206
+ name: "abs",
207
+ description: "returns the absolute value of the decimal.",
208
+ examples: [
209
+ "-1.5.abs",
210
+ "1.5.abs",
211
+ "0.0.abs"
212
+ ]
213
+ },
214
+ "between?" => {
215
+ name: "between?",
216
+ description: "returns whether the decimal is between two bounds.",
217
+ examples: [
218
+ "1.5.between?(1, 2)",
219
+ "3.5.between?(1, 2)",
220
+ "2.0.between?(1.5, 2.5)"
221
+ ]
222
+ },
223
+ "clamp" => {
224
+ name: "clamp",
225
+ description: "returns the decimal constrained between two bounds.",
226
+ examples: [
227
+ "5.5.clamp(1, 3)",
228
+ "0.5.clamp(1, 3)",
229
+ "2.5.clamp(1, 3)"
230
+ ]
231
+ },
232
+ "divide" => {
233
+ name: "divide",
234
+ description: "returns integer division of the decimal by another number.",
235
+ examples: [
236
+ "5.5.divide(2)",
237
+ "10.5.divide(3)",
238
+ "9.5.divide(2)"
239
+ ]
240
+ },
241
+ "divide_modulo" => {
242
+ name: "divide_modulo",
243
+ description: "returns integer division and modulo as a list.",
244
+ examples: [
245
+ "5.5.divide_modulo(2)",
246
+ "10.5.divide_modulo(3)",
247
+ "9.5.divide_modulo(2)"
248
+ ]
249
+ },
250
+ "ceil" => {
251
+ name: "ceil",
252
+ description: "returns the decimal rounded up.",
253
+ examples: [
254
+ "1.2.ceil",
255
+ "1.234.ceil(2)",
256
+ "-1.2.ceil"
257
+ ]
258
+ },
259
+ "day" => {
260
+ name: "day",
261
+ description: "returns a duration of this many days.",
262
+ examples: [
263
+ "1.5.day",
264
+ "2.0.day",
265
+ "0.5.day"
266
+ ]
267
+ },
268
+ "days" => {
269
+ name: "days",
270
+ description: "returns a duration of this many days.",
271
+ examples: [
272
+ "1.5.days",
273
+ "2.0.days",
274
+ "0.5.days"
275
+ ]
276
+ },
277
+ "floor" => {
278
+ name: "floor",
279
+ description: "returns the decimal rounded down.",
280
+ examples: [
281
+ "1.8.floor",
282
+ "1.234.floor(2)",
283
+ "-1.2.floor"
284
+ ]
285
+ },
286
+ "hour" => {
287
+ name: "hour",
288
+ description: "returns a duration of this many hours.",
289
+ examples: [
290
+ "1.5.hour",
291
+ "2.0.hour",
292
+ "0.5.hour"
293
+ ]
294
+ },
295
+ "hours" => {
296
+ name: "hours",
297
+ description: "returns a duration of this many hours.",
298
+ examples: [
299
+ "1.5.hours",
300
+ "2.0.hours",
301
+ "0.5.hours"
302
+ ]
303
+ },
304
+ "minute" => {
305
+ name: "minute",
306
+ description: "returns a duration of this many minutes.",
307
+ examples: [
308
+ "1.5.minute",
309
+ "2.0.minute",
310
+ "0.5.minute"
311
+ ]
312
+ },
313
+ "minutes" => {
314
+ name: "minutes",
315
+ description: "returns a duration of this many minutes.",
316
+ examples: [
317
+ "1.5.minutes",
318
+ "2.0.minutes",
319
+ "0.5.minutes"
320
+ ]
321
+ },
322
+ "month" => {
323
+ name: "month",
324
+ description: "returns a duration of this many months.",
325
+ examples: [
326
+ "1.5.month",
327
+ "2.0.month",
328
+ "0.5.month"
329
+ ]
330
+ },
331
+ "months" => {
332
+ name: "months",
333
+ description: "returns a duration of this many months.",
334
+ examples: [
335
+ "1.5.months",
336
+ "2.0.months",
337
+ "0.5.months"
338
+ ]
339
+ },
340
+ "next_decimal" => {
341
+ name: "next_decimal",
342
+ description: "alias for next.",
343
+ examples: [
344
+ "1.5.next_decimal",
345
+ "0.0.next_decimal",
346
+ "-1.5.next_decimal"
347
+ ]
348
+ },
349
+ "previous_decimal" => {
350
+ name: "previous_decimal",
351
+ description: "alias for previous.",
352
+ examples: [
353
+ "1.5.previous_decimal",
354
+ "0.0.previous_decimal",
355
+ "-1.5.previous_decimal"
356
+ ]
357
+ },
358
+ "round" => {
359
+ name: "round",
360
+ description: "returns the decimal rounded to a precision.",
361
+ examples: [
362
+ "1.5.round",
363
+ "1.234.round(2)",
364
+ "-1.5.round"
365
+ ]
366
+ },
367
+ "second" => {
368
+ name: "second",
369
+ description: "returns a duration of this many seconds.",
370
+ examples: [
371
+ "1.5.second",
372
+ "2.0.second",
373
+ "0.5.second"
374
+ ]
375
+ },
376
+ "seconds" => {
377
+ name: "seconds",
378
+ description: "returns a duration of this many seconds.",
379
+ examples: [
380
+ "1.5.seconds",
381
+ "2.0.seconds",
382
+ "0.5.seconds"
383
+ ]
384
+ },
385
+ "sqrt" => {
386
+ name: "sqrt",
387
+ description: "returns the square root of the decimal.",
388
+ examples: [
389
+ "4.0.sqrt",
390
+ "9.0.sqrt",
391
+ "2.25.sqrt"
392
+ ]
393
+ },
394
+ "truncate" => {
395
+ name: "truncate",
396
+ description: "returns the decimal truncated to a precision.",
397
+ examples: [
398
+ "1.9.truncate",
399
+ "1.234.truncate(2)",
400
+ "-1.9.truncate"
401
+ ]
402
+ },
403
+ "to_fixed" => {
404
+ name: "to_fixed",
405
+ description: "returns the decimal formatted with a fixed number of fractional digits.",
406
+ examples: [
407
+ "1.5.to_fixed",
408
+ "1.5.to_fixed(2)",
409
+ "1.234.to_fixed(1)"
410
+ ]
411
+ },
412
+ "to_precision" => {
413
+ name: "to_precision",
414
+ description: "returns the decimal formatted with a fixed number of significant digits.",
415
+ examples: [
416
+ "1.5.to_precision",
417
+ "1.234.to_precision(2)",
418
+ "123.4.to_precision(3)"
419
+ ]
420
+ },
421
+ "to_exponential" => {
422
+ name: "to_exponential",
423
+ description: "returns the decimal formatted with exponential notation.",
424
+ examples: [
425
+ "1.5.to_exponential",
426
+ "1.5.to_exponential(2)",
427
+ "123.4.to_exponential(1)"
428
+ ]
429
+ },
430
+ "week" => {
431
+ name: "week",
432
+ description: "returns a duration of this many weeks.",
433
+ examples: [
434
+ "1.5.week",
435
+ "2.0.week",
436
+ "0.5.week"
437
+ ]
438
+ },
439
+ "weeks" => {
440
+ name: "weeks",
441
+ description: "returns a duration of this many weeks.",
442
+ examples: [
443
+ "1.5.weeks",
444
+ "2.0.weeks",
445
+ "0.5.weeks"
446
+ ]
447
+ },
448
+ "year" => {
449
+ name: "year",
450
+ description: "returns a duration of this many years.",
451
+ examples: [
452
+ "1.5.year",
453
+ "2.0.year",
454
+ "0.5.year"
455
+ ]
456
+ },
457
+ "years" => {
458
+ name: "years",
459
+ description: "returns a duration of this many years.",
460
+ examples: [
461
+ "1.5.years",
462
+ "2.0.years",
463
+ "0.5.years"
464
+ ]
465
+ },
466
+ "|" => {
467
+ name: "|",
468
+ description: "returns the bitwise or of the decimal integer value and another number.",
469
+ examples: [
470
+ "5.5 | 2",
471
+ "4.0 | 1",
472
+ "7.0 | 2"
473
+ ]
474
+ },
475
+ "bitwise_or" => {
476
+ name: "bitwise_or",
477
+ description: "returns the bitwise or of the decimal integer value and another number.",
478
+ examples: [
479
+ "5.5.bitwise_or(2)",
480
+ "4.0.bitwise_or(1)",
481
+ "7.0.bitwise_or(2)"
482
+ ]
483
+ },
484
+ "many?" => {
485
+ name: "many?",
486
+ description: "returns whether the decimal is greater than one.",
487
+ examples: [
488
+ "2.0.many?",
489
+ "1.0.many?",
490
+ "0.5.many?"
491
+ ]
492
+ },
493
+ "any?" => {
494
+ name: "any?",
495
+ description: "returns whether the decimal is positive.",
496
+ examples: [
497
+ "1.0.any?",
498
+ "0.0.any?",
499
+ "-1.0.any?"
500
+ ]
501
+ },
502
+ "positive?" => {
503
+ name: "positive?",
504
+ description: "returns whether the decimal is positive.",
505
+ examples: [
506
+ "1.0.positive?",
507
+ "0.0.positive?",
508
+ "-1.0.positive?"
509
+ ]
510
+ },
511
+ "negative?" => {
512
+ name: "negative?",
513
+ description: "returns whether the decimal is negative.",
514
+ examples: [
515
+ "-1.0.negative?",
516
+ "0.0.negative?",
517
+ "1.0.negative?"
518
+ ]
519
+ },
520
+ "next" => {
521
+ name: "next",
522
+ description: "returns the decimal plus one.",
523
+ examples: [
524
+ "1.5.next",
525
+ "0.0.next",
526
+ "-1.5.next"
527
+ ]
528
+ },
529
+ "successor" => {
530
+ name: "successor",
531
+ description: "alias for next.",
532
+ examples: [
533
+ "1.5.successor",
534
+ "0.0.successor",
535
+ "-1.5.successor"
536
+ ]
537
+ },
538
+ "previous" => {
539
+ name: "previous",
540
+ description: "returns the decimal minus one.",
541
+ examples: [
542
+ "1.5.previous",
543
+ "0.0.previous",
544
+ "-1.5.previous"
545
+ ]
546
+ },
547
+ "predecessor" => {
548
+ name: "predecessor",
549
+ description: "alias for previous.",
550
+ examples: [
551
+ "1.5.predecessor",
552
+ "0.0.predecessor",
553
+ "-1.5.predecessor"
554
+ ]
555
+ },
556
+ "remainder" => {
557
+ name: "remainder",
558
+ description: "returns the remainder after division by another number.",
559
+ examples: [
560
+ "5.5.remainder(2)",
561
+ "10.5.remainder(3)",
562
+ "9.5.remainder(2)"
563
+ ]
564
+ },
565
+ "non_zero?" => {
566
+ name: "non_zero?",
567
+ description: "returns whether the decimal is not zero.",
568
+ examples: [
569
+ "1.0.non_zero?",
570
+ "0.0.non_zero?",
571
+ "-1.0.non_zero?"
572
+ ]
573
+ },
574
+ "integer?" => {
575
+ name: "integer?",
576
+ description: "returns whether the decimal has no fractional part.",
577
+ examples: [
578
+ "1.0.integer?",
579
+ "1.5.integer?",
580
+ "0.0.integer?"
581
+ ]
582
+ },
583
+ "finite?" => {
584
+ name: "finite?",
585
+ description: "returns whether the decimal is finite.",
586
+ examples: [
587
+ "1.0.finite?",
588
+ "0.0.finite?",
589
+ "-1.0.finite?"
590
+ ]
591
+ },
592
+ "infinite?" => {
593
+ name: "infinite?",
594
+ description: "returns whether the decimal is infinite.",
595
+ examples: [
596
+ "1.0.infinite?",
597
+ "0.0.infinite?",
598
+ "-1.0.infinite?"
599
+ ]
600
+ },
601
+ "not_a_number?" => {
602
+ name: "not_a_number?",
603
+ description: "returns whether the decimal is not a number.",
604
+ examples: [
605
+ "1.0.not_a_number?",
606
+ "0.0.not_a_number?",
607
+ "-1.0.not_a_number?"
608
+ ]
609
+ },
610
+ "numerator" => {
611
+ name: "numerator",
612
+ description: "returns the decimal numerator.",
613
+ examples: [
614
+ "1.5.numerator",
615
+ "2.0.numerator",
616
+ "0.5.numerator"
617
+ ]
618
+ },
619
+ "denominator" => {
620
+ name: "denominator",
621
+ description: "returns the decimal denominator.",
622
+ examples: [
623
+ "1.5.denominator",
624
+ "2.0.denominator",
625
+ "0.5.denominator"
626
+ ]
627
+ },
628
+ "magnitude" => {
629
+ name: "magnitude",
630
+ description: "returns the absolute value of the decimal.",
631
+ examples: [
632
+ "-1.5.magnitude",
633
+ "1.5.magnitude",
634
+ "0.0.magnitude"
635
+ ]
636
+ },
637
+ "zero?" => {
638
+ name: "zero?",
639
+ description: "returns whether the decimal is zero.",
640
+ examples: [
641
+ "0.0.zero?",
642
+ "1.0.zero?",
643
+ "0.5.zero?"
644
+ ]
645
+ },
646
+ "one?" => {
647
+ name: "one?",
648
+ description: "returns whether the decimal is one.",
649
+ examples: [
650
+ "1.0.one?",
651
+ "2.0.one?",
652
+ "0.5.one?"
653
+ ]
654
+ },
655
+ "two?" => {
656
+ name: "two?",
657
+ description: "returns whether the decimal is two.",
658
+ examples: [
659
+ "2.0.two?",
660
+ "3.0.two?",
661
+ "0.5.two?"
662
+ ]
663
+ },
664
+ "three?" => {
665
+ name: "three?",
666
+ description: "returns whether the decimal is three.",
667
+ examples: [
668
+ "3.0.three?",
669
+ "4.0.three?",
670
+ "0.5.three?"
671
+ ]
672
+ },
673
+ "four?" => {
674
+ name: "four?",
675
+ description: "returns whether the decimal is four.",
676
+ examples: [
677
+ "4.0.four?",
678
+ "5.0.four?",
679
+ "0.5.four?"
680
+ ]
681
+ },
682
+ "five?" => {
683
+ name: "five?",
684
+ description: "returns whether the decimal is five.",
685
+ examples: [
686
+ "5.0.five?",
687
+ "6.0.five?",
688
+ "0.5.five?"
689
+ ]
690
+ },
691
+ "six?" => {
692
+ name: "six?",
693
+ description: "returns whether the decimal is six.",
694
+ examples: [
695
+ "6.0.six?",
696
+ "7.0.six?",
697
+ "0.5.six?"
698
+ ]
699
+ },
700
+ "seven?" => {
701
+ name: "seven?",
702
+ description: "returns whether the decimal is seven.",
703
+ examples: [
704
+ "7.0.seven?",
705
+ "8.0.seven?",
706
+ "0.5.seven?"
707
+ ]
708
+ },
709
+ "eight?" => {
710
+ name: "eight?",
711
+ description: "returns whether the decimal is eight.",
712
+ examples: [
713
+ "8.0.eight?",
714
+ "9.0.eight?",
715
+ "0.5.eight?"
716
+ ]
717
+ },
718
+ "nine?" => {
719
+ name: "nine?",
720
+ description: "returns whether the decimal is nine.",
721
+ examples: [
722
+ "9.0.nine?",
723
+ "10.0.nine?",
724
+ "0.5.nine?"
725
+ ]
726
+ },
727
+ "ten?" => {
728
+ name: "ten?",
729
+ description: "returns whether the decimal is ten.",
730
+ examples: [
731
+ "10.0.ten?",
732
+ "11.0.ten?",
733
+ "0.5.ten?"
734
+ ]
735
+ },
736
+ "eleven?" => {
737
+ name: "eleven?",
738
+ description: "returns whether the decimal is eleven.",
739
+ examples: [
740
+ "11.0.eleven?",
741
+ "12.0.eleven?",
742
+ "0.5.eleven?"
743
+ ]
744
+ },
745
+ "twelve?" => {
746
+ name: "twelve?",
747
+ description: "returns whether the decimal is twelve.",
748
+ examples: [
749
+ "12.0.twelve?",
750
+ "13.0.twelve?",
751
+ "0.5.twelve?"
752
+ ]
753
+ },
754
+ "thirteen?" => {
755
+ name: "thirteen?",
756
+ description: "returns whether the decimal is thirteen.",
757
+ examples: [
758
+ "13.0.thirteen?",
759
+ "14.0.thirteen?",
760
+ "0.5.thirteen?"
761
+ ]
762
+ },
763
+ "fourteen?" => {
764
+ name: "fourteen?",
765
+ description: "returns whether the decimal is fourteen.",
766
+ examples: [
767
+ "14.0.fourteen?",
768
+ "15.0.fourteen?",
769
+ "0.5.fourteen?"
770
+ ]
771
+ },
772
+ "fifteen?" => {
773
+ name: "fifteen?",
774
+ description: "returns whether the decimal is fifteen.",
775
+ examples: [
776
+ "15.0.fifteen?",
777
+ "16.0.fifteen?",
778
+ "0.5.fifteen?"
779
+ ]
780
+ },
781
+ "sixteen?" => {
782
+ name: "sixteen?",
783
+ description: "returns whether the decimal is sixteen.",
784
+ examples: [
785
+ "16.0.sixteen?",
786
+ "17.0.sixteen?",
787
+ "0.5.sixteen?"
788
+ ]
789
+ },
790
+ "seventeen?" => {
791
+ name: "seventeen?",
792
+ description: "returns whether the decimal is seventeen.",
793
+ examples: [
794
+ "17.0.seventeen?",
795
+ "18.0.seventeen?",
796
+ "0.5.seventeen?"
797
+ ]
798
+ },
799
+ "eighteen?" => {
800
+ name: "eighteen?",
801
+ description: "returns whether the decimal is eighteen.",
802
+ examples: [
803
+ "18.0.eighteen?",
804
+ "19.0.eighteen?",
805
+ "0.5.eighteen?"
806
+ ]
807
+ },
808
+ "nineteen?" => {
809
+ name: "nineteen?",
810
+ description: "returns whether the decimal is nineteen.",
811
+ examples: [
812
+ "19.0.nineteen?",
813
+ "20.0.nineteen?",
814
+ "0.5.nineteen?"
815
+ ]
816
+ },
817
+ "twenty?" => {
818
+ name: "twenty?",
819
+ description: "returns whether the decimal is twenty.",
820
+ examples: [
821
+ "20.0.twenty?",
822
+ "21.0.twenty?",
823
+ "0.5.twenty?"
824
+ ]
825
+ },
826
+ "twenty_one?" => {
827
+ name: "twenty_one?",
828
+ description: "returns whether the decimal is twenty one.",
829
+ examples: [
830
+ "21.0.twenty_one?",
831
+ "22.0.twenty_one?",
832
+ "0.5.twenty_one?"
833
+ ]
834
+ },
835
+ "twenty_two?" => {
836
+ name: "twenty_two?",
837
+ description: "returns whether the decimal is twenty two.",
838
+ examples: [
839
+ "22.0.twenty_two?",
840
+ "23.0.twenty_two?",
841
+ "0.5.twenty_two?"
842
+ ]
843
+ },
844
+ "twenty_three?" => {
845
+ name: "twenty_three?",
846
+ description: "returns whether the decimal is twenty three.",
847
+ examples: [
848
+ "23.0.twenty_three?",
849
+ "24.0.twenty_three?",
850
+ "0.5.twenty_three?"
851
+ ]
852
+ },
853
+ "twenty_four?" => {
854
+ name: "twenty_four?",
855
+ description: "returns whether the decimal is twenty four.",
856
+ examples: [
857
+ "24.0.twenty_four?",
858
+ "25.0.twenty_four?",
859
+ "0.5.twenty_four?"
860
+ ]
861
+ },
862
+ "twenty_five?" => {
863
+ name: "twenty_five?",
864
+ description: "returns whether the decimal is twenty five.",
865
+ examples: [
866
+ "25.0.twenty_five?",
867
+ "26.0.twenty_five?",
868
+ "0.5.twenty_five?"
869
+ ]
870
+ },
871
+ "twenty_six?" => {
872
+ name: "twenty_six?",
873
+ description: "returns whether the decimal is twenty six.",
874
+ examples: [
875
+ "26.0.twenty_six?",
876
+ "27.0.twenty_six?",
877
+ "0.5.twenty_six?"
878
+ ]
879
+ },
880
+ "twenty_seven?" => {
881
+ name: "twenty_seven?",
882
+ description: "returns whether the decimal is twenty seven.",
883
+ examples: [
884
+ "27.0.twenty_seven?",
885
+ "28.0.twenty_seven?",
886
+ "0.5.twenty_seven?"
887
+ ]
888
+ },
889
+ "twenty_eight?" => {
890
+ name: "twenty_eight?",
891
+ description: "returns whether the decimal is twenty eight.",
892
+ examples: [
893
+ "28.0.twenty_eight?",
894
+ "29.0.twenty_eight?",
895
+ "0.5.twenty_eight?"
896
+ ]
897
+ },
898
+ "twenty_nine?" => {
899
+ name: "twenty_nine?",
900
+ description: "returns whether the decimal is twenty nine.",
901
+ examples: [
902
+ "29.0.twenty_nine?",
903
+ "30.0.twenty_nine?",
904
+ "0.5.twenty_nine?"
905
+ ]
906
+ },
907
+ "thirty?" => {
908
+ name: "thirty?",
909
+ description: "returns whether the decimal is thirty.",
910
+ examples: [
911
+ "30.0.thirty?",
912
+ "31.0.thirty?",
913
+ "0.5.thirty?"
914
+ ]
915
+ },
916
+ "thirty_one?" => {
917
+ name: "thirty_one?",
918
+ description: "returns whether the decimal is thirty one.",
919
+ examples: [
920
+ "31.0.thirty_one?",
921
+ "32.0.thirty_one?",
922
+ "0.5.thirty_one?"
923
+ ]
924
+ },
925
+ "thirty_two?" => {
926
+ name: "thirty_two?",
927
+ description: "returns whether the decimal is thirty two.",
928
+ examples: [
929
+ "32.0.thirty_two?",
930
+ "33.0.thirty_two?",
931
+ "0.5.thirty_two?"
932
+ ]
933
+ },
934
+ "thirty_three?" => {
935
+ name: "thirty_three?",
936
+ description: "returns whether the decimal is thirty three.",
937
+ examples: [
938
+ "33.0.thirty_three?",
939
+ "34.0.thirty_three?",
940
+ "0.5.thirty_three?"
941
+ ]
942
+ },
943
+ "thirty_four?" => {
944
+ name: "thirty_four?",
945
+ description: "returns whether the decimal is thirty four.",
946
+ examples: [
947
+ "34.0.thirty_four?",
948
+ "35.0.thirty_four?",
949
+ "0.5.thirty_four?"
950
+ ]
951
+ },
952
+ "thirty_five?" => {
953
+ name: "thirty_five?",
954
+ description: "returns whether the decimal is thirty five.",
955
+ examples: [
956
+ "35.0.thirty_five?",
957
+ "36.0.thirty_five?",
958
+ "0.5.thirty_five?"
959
+ ]
960
+ },
961
+ "thirty_six?" => {
962
+ name: "thirty_six?",
963
+ description: "returns whether the decimal is thirty six.",
964
+ examples: [
965
+ "36.0.thirty_six?",
966
+ "37.0.thirty_six?",
967
+ "0.5.thirty_six?"
968
+ ]
969
+ },
970
+ "thirty_seven?" => {
971
+ name: "thirty_seven?",
972
+ description: "returns whether the decimal is thirty seven.",
973
+ examples: [
974
+ "37.0.thirty_seven?",
975
+ "38.0.thirty_seven?",
976
+ "0.5.thirty_seven?"
977
+ ]
978
+ },
979
+ "thirty_eight?" => {
980
+ name: "thirty_eight?",
981
+ description: "returns whether the decimal is thirty eight.",
982
+ examples: [
983
+ "38.0.thirty_eight?",
984
+ "39.0.thirty_eight?",
985
+ "0.5.thirty_eight?"
986
+ ]
987
+ },
988
+ "thirty_nine?" => {
989
+ name: "thirty_nine?",
990
+ description: "returns whether the decimal is thirty nine.",
991
+ examples: [
992
+ "39.0.thirty_nine?",
993
+ "40.0.thirty_nine?",
994
+ "0.5.thirty_nine?"
995
+ ]
996
+ },
997
+ "forty?" => {
998
+ name: "forty?",
999
+ description: "returns whether the decimal is forty.",
1000
+ examples: [
1001
+ "40.0.forty?",
1002
+ "41.0.forty?",
1003
+ "0.5.forty?"
1004
+ ]
1005
+ },
1006
+ "forty_one?" => {
1007
+ name: "forty_one?",
1008
+ description: "returns whether the decimal is forty one.",
1009
+ examples: [
1010
+ "41.0.forty_one?",
1011
+ "42.0.forty_one?",
1012
+ "0.5.forty_one?"
1013
+ ]
1014
+ },
1015
+ "forty_two?" => {
1016
+ name: "forty_two?",
1017
+ description: "returns whether the decimal is forty two.",
1018
+ examples: [
1019
+ "42.0.forty_two?",
1020
+ "43.0.forty_two?",
1021
+ "0.5.forty_two?"
1022
+ ]
1023
+ },
1024
+ "forty_three?" => {
1025
+ name: "forty_three?",
1026
+ description: "returns whether the decimal is forty three.",
1027
+ examples: [
1028
+ "43.0.forty_three?",
1029
+ "44.0.forty_three?",
1030
+ "0.5.forty_three?"
1031
+ ]
1032
+ },
1033
+ "forty_four?" => {
1034
+ name: "forty_four?",
1035
+ description: "returns whether the decimal is forty four.",
1036
+ examples: [
1037
+ "44.0.forty_four?",
1038
+ "45.0.forty_four?",
1039
+ "0.5.forty_four?"
1040
+ ]
1041
+ },
1042
+ "forty_five?" => {
1043
+ name: "forty_five?",
1044
+ description: "returns whether the decimal is forty five.",
1045
+ examples: [
1046
+ "45.0.forty_five?",
1047
+ "46.0.forty_five?",
1048
+ "0.5.forty_five?"
1049
+ ]
1050
+ },
1051
+ "forty_six?" => {
1052
+ name: "forty_six?",
1053
+ description: "returns whether the decimal is forty six.",
1054
+ examples: [
1055
+ "46.0.forty_six?",
1056
+ "47.0.forty_six?",
1057
+ "0.5.forty_six?"
1058
+ ]
1059
+ },
1060
+ "forty_seven?" => {
1061
+ name: "forty_seven?",
1062
+ description: "returns whether the decimal is forty seven.",
1063
+ examples: [
1064
+ "47.0.forty_seven?",
1065
+ "48.0.forty_seven?",
1066
+ "0.5.forty_seven?"
1067
+ ]
1068
+ },
1069
+ "forty_eight?" => {
1070
+ name: "forty_eight?",
1071
+ description: "returns whether the decimal is forty eight.",
1072
+ examples: [
1073
+ "48.0.forty_eight?",
1074
+ "49.0.forty_eight?",
1075
+ "0.5.forty_eight?"
1076
+ ]
1077
+ },
1078
+ "forty_nine?" => {
1079
+ name: "forty_nine?",
1080
+ description: "returns whether the decimal is forty nine.",
1081
+ examples: [
1082
+ "49.0.forty_nine?",
1083
+ "50.0.forty_nine?",
1084
+ "0.5.forty_nine?"
1085
+ ]
1086
+ },
1087
+ "fifty?" => {
1088
+ name: "fifty?",
1089
+ description: "returns whether the decimal is fifty.",
1090
+ examples: [
1091
+ "50.0.fifty?",
1092
+ "51.0.fifty?",
1093
+ "0.5.fifty?"
1094
+ ]
1095
+ },
1096
+ "fifty_one?" => {
1097
+ name: "fifty_one?",
1098
+ description: "returns whether the decimal is fifty one.",
1099
+ examples: [
1100
+ "51.0.fifty_one?",
1101
+ "52.0.fifty_one?",
1102
+ "0.5.fifty_one?"
1103
+ ]
1104
+ },
1105
+ "fifty_two?" => {
1106
+ name: "fifty_two?",
1107
+ description: "returns whether the decimal is fifty two.",
1108
+ examples: [
1109
+ "52.0.fifty_two?",
1110
+ "53.0.fifty_two?",
1111
+ "0.5.fifty_two?"
1112
+ ]
1113
+ },
1114
+ "fifty_three?" => {
1115
+ name: "fifty_three?",
1116
+ description: "returns whether the decimal is fifty three.",
1117
+ examples: [
1118
+ "53.0.fifty_three?",
1119
+ "54.0.fifty_three?",
1120
+ "0.5.fifty_three?"
1121
+ ]
1122
+ },
1123
+ "fifty_four?" => {
1124
+ name: "fifty_four?",
1125
+ description: "returns whether the decimal is fifty four.",
1126
+ examples: [
1127
+ "54.0.fifty_four?",
1128
+ "55.0.fifty_four?",
1129
+ "0.5.fifty_four?"
1130
+ ]
1131
+ },
1132
+ "fifty_five?" => {
1133
+ name: "fifty_five?",
1134
+ description: "returns whether the decimal is fifty five.",
1135
+ examples: [
1136
+ "55.0.fifty_five?",
1137
+ "56.0.fifty_five?",
1138
+ "0.5.fifty_five?"
1139
+ ]
1140
+ },
1141
+ "fifty_six?" => {
1142
+ name: "fifty_six?",
1143
+ description: "returns whether the decimal is fifty six.",
1144
+ examples: [
1145
+ "56.0.fifty_six?",
1146
+ "57.0.fifty_six?",
1147
+ "0.5.fifty_six?"
1148
+ ]
1149
+ },
1150
+ "fifty_seven?" => {
1151
+ name: "fifty_seven?",
1152
+ description: "returns whether the decimal is fifty seven.",
1153
+ examples: [
1154
+ "57.0.fifty_seven?",
1155
+ "58.0.fifty_seven?",
1156
+ "0.5.fifty_seven?"
1157
+ ]
1158
+ },
1159
+ "fifty_eight?" => {
1160
+ name: "fifty_eight?",
1161
+ description: "returns whether the decimal is fifty eight.",
1162
+ examples: [
1163
+ "58.0.fifty_eight?",
1164
+ "59.0.fifty_eight?",
1165
+ "0.5.fifty_eight?"
1166
+ ]
1167
+ },
1168
+ "fifty_nine?" => {
1169
+ name: "fifty_nine?",
1170
+ description: "returns whether the decimal is fifty nine.",
1171
+ examples: [
1172
+ "59.0.fifty_nine?",
1173
+ "60.0.fifty_nine?",
1174
+ "0.5.fifty_nine?"
1175
+ ]
1176
+ },
1177
+ "sixty?" => {
1178
+ name: "sixty?",
1179
+ description: "returns whether the decimal is sixty.",
1180
+ examples: [
1181
+ "60.0.sixty?",
1182
+ "61.0.sixty?",
1183
+ "0.5.sixty?"
1184
+ ]
1185
+ },
1186
+ "sixty_one?" => {
1187
+ name: "sixty_one?",
1188
+ description: "returns whether the decimal is sixty one.",
1189
+ examples: [
1190
+ "61.0.sixty_one?",
1191
+ "62.0.sixty_one?",
1192
+ "0.5.sixty_one?"
1193
+ ]
1194
+ },
1195
+ "sixty_two?" => {
1196
+ name: "sixty_two?",
1197
+ description: "returns whether the decimal is sixty two.",
1198
+ examples: [
1199
+ "62.0.sixty_two?",
1200
+ "63.0.sixty_two?",
1201
+ "0.5.sixty_two?"
1202
+ ]
1203
+ },
1204
+ "sixty_three?" => {
1205
+ name: "sixty_three?",
1206
+ description: "returns whether the decimal is sixty three.",
1207
+ examples: [
1208
+ "63.0.sixty_three?",
1209
+ "64.0.sixty_three?",
1210
+ "0.5.sixty_three?"
1211
+ ]
1212
+ },
1213
+ "sixty_four?" => {
1214
+ name: "sixty_four?",
1215
+ description: "returns whether the decimal is sixty four.",
1216
+ examples: [
1217
+ "64.0.sixty_four?",
1218
+ "65.0.sixty_four?",
1219
+ "0.5.sixty_four?"
1220
+ ]
1221
+ },
1222
+ "sixty_five?" => {
1223
+ name: "sixty_five?",
1224
+ description: "returns whether the decimal is sixty five.",
1225
+ examples: [
1226
+ "65.0.sixty_five?",
1227
+ "66.0.sixty_five?",
1228
+ "0.5.sixty_five?"
1229
+ ]
1230
+ },
1231
+ "sixty_six?" => {
1232
+ name: "sixty_six?",
1233
+ description: "returns whether the decimal is sixty six.",
1234
+ examples: [
1235
+ "66.0.sixty_six?",
1236
+ "67.0.sixty_six?",
1237
+ "0.5.sixty_six?"
1238
+ ]
1239
+ },
1240
+ "sixty_seven?" => {
1241
+ name: "sixty_seven?",
1242
+ description: "returns whether the decimal is sixty seven.",
1243
+ examples: [
1244
+ "67.0.sixty_seven?",
1245
+ "68.0.sixty_seven?",
1246
+ "0.5.sixty_seven?"
1247
+ ]
1248
+ },
1249
+ "sixty_eight?" => {
1250
+ name: "sixty_eight?",
1251
+ description: "returns whether the decimal is sixty eight.",
1252
+ examples: [
1253
+ "68.0.sixty_eight?",
1254
+ "69.0.sixty_eight?",
1255
+ "0.5.sixty_eight?"
1256
+ ]
1257
+ },
1258
+ "sixty_nine?" => {
1259
+ name: "sixty_nine?",
1260
+ description: "returns whether the decimal is sixty nine.",
1261
+ examples: [
1262
+ "69.0.sixty_nine?",
1263
+ "70.0.sixty_nine?",
1264
+ "0.5.sixty_nine?"
1265
+ ]
1266
+ },
1267
+ "seventy?" => {
1268
+ name: "seventy?",
1269
+ description: "returns whether the decimal is seventy.",
1270
+ examples: [
1271
+ "70.0.seventy?",
1272
+ "71.0.seventy?",
1273
+ "0.5.seventy?"
1274
+ ]
1275
+ },
1276
+ "seventy_one?" => {
1277
+ name: "seventy_one?",
1278
+ description: "returns whether the decimal is seventy one.",
1279
+ examples: [
1280
+ "71.0.seventy_one?",
1281
+ "72.0.seventy_one?",
1282
+ "0.5.seventy_one?"
1283
+ ]
1284
+ },
1285
+ "seventy_two?" => {
1286
+ name: "seventy_two?",
1287
+ description: "returns whether the decimal is seventy two.",
1288
+ examples: [
1289
+ "72.0.seventy_two?",
1290
+ "73.0.seventy_two?",
1291
+ "0.5.seventy_two?"
1292
+ ]
1293
+ },
1294
+ "seventy_three?" => {
1295
+ name: "seventy_three?",
1296
+ description: "returns whether the decimal is seventy three.",
1297
+ examples: [
1298
+ "73.0.seventy_three?",
1299
+ "74.0.seventy_three?",
1300
+ "0.5.seventy_three?"
1301
+ ]
1302
+ },
1303
+ "seventy_four?" => {
1304
+ name: "seventy_four?",
1305
+ description: "returns whether the decimal is seventy four.",
1306
+ examples: [
1307
+ "74.0.seventy_four?",
1308
+ "75.0.seventy_four?",
1309
+ "0.5.seventy_four?"
1310
+ ]
1311
+ },
1312
+ "seventy_five?" => {
1313
+ name: "seventy_five?",
1314
+ description: "returns whether the decimal is seventy five.",
1315
+ examples: [
1316
+ "75.0.seventy_five?",
1317
+ "76.0.seventy_five?",
1318
+ "0.5.seventy_five?"
1319
+ ]
1320
+ },
1321
+ "seventy_six?" => {
1322
+ name: "seventy_six?",
1323
+ description: "returns whether the decimal is seventy six.",
1324
+ examples: [
1325
+ "76.0.seventy_six?",
1326
+ "77.0.seventy_six?",
1327
+ "0.5.seventy_six?"
1328
+ ]
1329
+ },
1330
+ "seventy_seven?" => {
1331
+ name: "seventy_seven?",
1332
+ description: "returns whether the decimal is seventy seven.",
1333
+ examples: [
1334
+ "77.0.seventy_seven?",
1335
+ "78.0.seventy_seven?",
1336
+ "0.5.seventy_seven?"
1337
+ ]
1338
+ },
1339
+ "seventy_eight?" => {
1340
+ name: "seventy_eight?",
1341
+ description: "returns whether the decimal is seventy eight.",
1342
+ examples: [
1343
+ "78.0.seventy_eight?",
1344
+ "79.0.seventy_eight?",
1345
+ "0.5.seventy_eight?"
1346
+ ]
1347
+ },
1348
+ "seventy_nine?" => {
1349
+ name: "seventy_nine?",
1350
+ description: "returns whether the decimal is seventy nine.",
1351
+ examples: [
1352
+ "79.0.seventy_nine?",
1353
+ "80.0.seventy_nine?",
1354
+ "0.5.seventy_nine?"
1355
+ ]
1356
+ },
1357
+ "eighty?" => {
1358
+ name: "eighty?",
1359
+ description: "returns whether the decimal is eighty.",
1360
+ examples: [
1361
+ "80.0.eighty?",
1362
+ "81.0.eighty?",
1363
+ "0.5.eighty?"
1364
+ ]
1365
+ },
1366
+ "eighty_one?" => {
1367
+ name: "eighty_one?",
1368
+ description: "returns whether the decimal is eighty one.",
1369
+ examples: [
1370
+ "81.0.eighty_one?",
1371
+ "82.0.eighty_one?",
1372
+ "0.5.eighty_one?"
1373
+ ]
1374
+ },
1375
+ "eighty_two?" => {
1376
+ name: "eighty_two?",
1377
+ description: "returns whether the decimal is eighty two.",
1378
+ examples: [
1379
+ "82.0.eighty_two?",
1380
+ "83.0.eighty_two?",
1381
+ "0.5.eighty_two?"
1382
+ ]
1383
+ },
1384
+ "eighty_three?" => {
1385
+ name: "eighty_three?",
1386
+ description: "returns whether the decimal is eighty three.",
1387
+ examples: [
1388
+ "83.0.eighty_three?",
1389
+ "84.0.eighty_three?",
1390
+ "0.5.eighty_three?"
1391
+ ]
1392
+ },
1393
+ "eighty_four?" => {
1394
+ name: "eighty_four?",
1395
+ description: "returns whether the decimal is eighty four.",
1396
+ examples: [
1397
+ "84.0.eighty_four?",
1398
+ "85.0.eighty_four?",
1399
+ "0.5.eighty_four?"
1400
+ ]
1401
+ },
1402
+ "eighty_five?" => {
1403
+ name: "eighty_five?",
1404
+ description: "returns whether the decimal is eighty five.",
1405
+ examples: [
1406
+ "85.0.eighty_five?",
1407
+ "86.0.eighty_five?",
1408
+ "0.5.eighty_five?"
1409
+ ]
1410
+ },
1411
+ "eighty_six?" => {
1412
+ name: "eighty_six?",
1413
+ description: "returns whether the decimal is eighty six.",
1414
+ examples: [
1415
+ "86.0.eighty_six?",
1416
+ "87.0.eighty_six?",
1417
+ "0.5.eighty_six?"
1418
+ ]
1419
+ },
1420
+ "eighty_seven?" => {
1421
+ name: "eighty_seven?",
1422
+ description: "returns whether the decimal is eighty seven.",
1423
+ examples: [
1424
+ "87.0.eighty_seven?",
1425
+ "88.0.eighty_seven?",
1426
+ "0.5.eighty_seven?"
1427
+ ]
1428
+ },
1429
+ "eighty_eight?" => {
1430
+ name: "eighty_eight?",
1431
+ description: "returns whether the decimal is eighty eight.",
1432
+ examples: [
1433
+ "88.0.eighty_eight?",
1434
+ "89.0.eighty_eight?",
1435
+ "0.5.eighty_eight?"
1436
+ ]
1437
+ },
1438
+ "eighty_nine?" => {
1439
+ name: "eighty_nine?",
1440
+ description: "returns whether the decimal is eighty nine.",
1441
+ examples: [
1442
+ "89.0.eighty_nine?",
1443
+ "90.0.eighty_nine?",
1444
+ "0.5.eighty_nine?"
1445
+ ]
1446
+ },
1447
+ "ninety?" => {
1448
+ name: "ninety?",
1449
+ description: "returns whether the decimal is ninety.",
1450
+ examples: [
1451
+ "90.0.ninety?",
1452
+ "91.0.ninety?",
1453
+ "0.5.ninety?"
1454
+ ]
1455
+ },
1456
+ "ninety_one?" => {
1457
+ name: "ninety_one?",
1458
+ description: "returns whether the decimal is ninety one.",
1459
+ examples: [
1460
+ "91.0.ninety_one?",
1461
+ "92.0.ninety_one?",
1462
+ "0.5.ninety_one?"
1463
+ ]
1464
+ },
1465
+ "ninety_two?" => {
1466
+ name: "ninety_two?",
1467
+ description: "returns whether the decimal is ninety two.",
1468
+ examples: [
1469
+ "92.0.ninety_two?",
1470
+ "93.0.ninety_two?",
1471
+ "0.5.ninety_two?"
1472
+ ]
1473
+ },
1474
+ "ninety_three?" => {
1475
+ name: "ninety_three?",
1476
+ description: "returns whether the decimal is ninety three.",
1477
+ examples: [
1478
+ "93.0.ninety_three?",
1479
+ "94.0.ninety_three?",
1480
+ "0.5.ninety_three?"
1481
+ ]
1482
+ },
1483
+ "ninety_four?" => {
1484
+ name: "ninety_four?",
1485
+ description: "returns whether the decimal is ninety four.",
1486
+ examples: [
1487
+ "94.0.ninety_four?",
1488
+ "95.0.ninety_four?",
1489
+ "0.5.ninety_four?"
1490
+ ]
1491
+ },
1492
+ "ninety_five?" => {
1493
+ name: "ninety_five?",
1494
+ description: "returns whether the decimal is ninety five.",
1495
+ examples: [
1496
+ "95.0.ninety_five?",
1497
+ "96.0.ninety_five?",
1498
+ "0.5.ninety_five?"
1499
+ ]
1500
+ },
1501
+ "ninety_six?" => {
1502
+ name: "ninety_six?",
1503
+ description: "returns whether the decimal is ninety six.",
1504
+ examples: [
1505
+ "96.0.ninety_six?",
1506
+ "97.0.ninety_six?",
1507
+ "0.5.ninety_six?"
1508
+ ]
1509
+ },
1510
+ "ninety_seven?" => {
1511
+ name: "ninety_seven?",
1512
+ description: "returns whether the decimal is ninety seven.",
1513
+ examples: [
1514
+ "97.0.ninety_seven?",
1515
+ "98.0.ninety_seven?",
1516
+ "0.5.ninety_seven?"
1517
+ ]
1518
+ },
1519
+ "ninety_eight?" => {
1520
+ name: "ninety_eight?",
1521
+ description: "returns whether the decimal is ninety eight.",
1522
+ examples: [
1523
+ "98.0.ninety_eight?",
1524
+ "99.0.ninety_eight?",
1525
+ "0.5.ninety_eight?"
1526
+ ]
1527
+ },
1528
+ "ninety_nine?" => {
1529
+ name: "ninety_nine?",
1530
+ description: "returns whether the decimal is ninety nine.",
1531
+ examples: [
1532
+ "99.0.ninety_nine?",
1533
+ "100.0.ninety_nine?",
1534
+ "0.5.ninety_nine?"
1535
+ ]
1536
+ },
1537
+ "one_hundred?" => {
1538
+ name: "one_hundred?",
1539
+ description: "returns whether the decimal is one hundred.",
1540
+ examples: [
1541
+ "100.0.one_hundred?",
1542
+ "101.0.one_hundred?",
1543
+ "0.5.one_hundred?"
1544
+ ]
1545
+ }
1546
+ }.freeze
1547
+
1548
+ def self.function_documentation(scope)
1549
+ return INSTANCE_FUNCTIONS if scope == :instance
1550
+
1551
+ {}
1552
+ end
1553
+
6
1554
  def initialize(*args, **_kargs, &_block)
7
1555
  self.raw =
8
1556
  if args.first.class.in?(NUMBER_CLASSES)
@@ -45,6 +1593,15 @@ class Code
45
1593
  when "/", "division"
46
1594
  sig(args) { Integer | Decimal }
47
1595
  code_division(code_value)
1596
+ when "divide"
1597
+ sig(args) { Integer | Decimal }
1598
+ code_divide(code_value)
1599
+ when "divide_modulo"
1600
+ sig(args) { Integer | Decimal }
1601
+ code_divide_modulo(code_value)
1602
+ when "decimal_divide"
1603
+ sig(args) { Integer | Decimal }
1604
+ code_decimal_divide(code_value)
48
1605
  when "<<", "left_shift"
49
1606
  sig(args) { Integer | Decimal }
50
1607
  code_left_shift(code_value)
@@ -57,21 +1614,72 @@ class Code
57
1614
  when "abs"
58
1615
  sig(args)
59
1616
  code_abs
1617
+ when "between?"
1618
+ sig(args) { [Integer | Decimal, Integer | Decimal] }
1619
+ code_between?(*code_arguments.raw)
60
1620
  when "ceil"
61
1621
  sig(args) { Integer.maybe }
62
1622
  code_ceil(code_value)
1623
+ when "clamp"
1624
+ sig(args) { [Integer | Decimal, Integer | Decimal] }
1625
+ code_clamp(*code_arguments.raw)
1626
+ when "day", "days"
1627
+ sig(args)
1628
+ code_days
63
1629
  when "floor"
64
1630
  sig(args) { Integer.maybe }
65
1631
  code_floor(code_value)
1632
+ when "hour", "hours"
1633
+ sig(args)
1634
+ code_hours
1635
+ when "minute", "minutes"
1636
+ sig(args)
1637
+ code_minutes
1638
+ when "month", "months"
1639
+ sig(args)
1640
+ code_months
1641
+ when "next", "successor"
1642
+ sig(args)
1643
+ code_next
1644
+ when "next_decimal"
1645
+ sig(args)
1646
+ code_next_decimal
1647
+ when "previous", "predecessor"
1648
+ sig(args)
1649
+ code_previous
1650
+ when "previous_decimal"
1651
+ sig(args)
1652
+ code_previous_decimal
1653
+ when "remainder"
1654
+ sig(args) { Integer | Decimal }
1655
+ code_remainder(code_value)
66
1656
  when "round"
67
1657
  sig(args) { Integer.maybe }
68
1658
  code_round(code_value)
1659
+ when "second", "seconds"
1660
+ sig(args)
1661
+ code_seconds
69
1662
  when "sqrt"
70
1663
  sig(args)
71
1664
  code_sqrt
72
1665
  when "truncate"
73
1666
  sig(args) { Integer.maybe }
74
1667
  code_truncate(code_value)
1668
+ when "to_fixed"
1669
+ sig(args) { Integer.maybe }
1670
+ code_to_fixed(code_value)
1671
+ when "to_precision"
1672
+ sig(args) { Integer.maybe }
1673
+ code_to_precision(code_value)
1674
+ when "to_exponential"
1675
+ sig(args) { Integer.maybe }
1676
+ code_to_exponential(code_value)
1677
+ when "week", "weeks"
1678
+ sig(args)
1679
+ code_weeks
1680
+ when "year", "years"
1681
+ sig(args)
1682
+ code_years
75
1683
  when "|", "bitwise_or"
76
1684
  sig(args) { Integer | Decimal }
77
1685
  code_bitwise_or(code_value)
@@ -87,6 +1695,30 @@ class Code
87
1695
  when "negative?"
88
1696
  sig(args)
89
1697
  code_negative?
1698
+ when "non_zero?"
1699
+ sig(args)
1700
+ code_non_zero?
1701
+ when "integer?"
1702
+ sig(args)
1703
+ code_integer?
1704
+ when "finite?"
1705
+ sig(args)
1706
+ code_finite?
1707
+ when "infinite?"
1708
+ sig(args)
1709
+ code_infinite?
1710
+ when "not_a_number?"
1711
+ sig(args)
1712
+ code_not_a_number?
1713
+ when "numerator"
1714
+ sig(args)
1715
+ code_numerator
1716
+ when "denominator"
1717
+ sig(args)
1718
+ code_denominator
1719
+ when "magnitude"
1720
+ sig(args)
1721
+ code_magnitude
90
1722
  when "zero?"
91
1723
  sig(args)
92
1724
  code_zero?
@@ -430,6 +2062,10 @@ class Code
430
2062
  Decimal.new(raw / code_other.raw)
431
2063
  end
432
2064
 
2065
+ def code_decimal_divide(other)
2066
+ code_division(other)
2067
+ end
2068
+
433
2069
  def code_floor(n = nil)
434
2070
  code_n = n.to_code
435
2071
  code_n = Integer.new(0) if code_n.nothing?
@@ -437,6 +2073,34 @@ class Code
437
2073
  Decimal.new(raw.floor(code_n.raw))
438
2074
  end
439
2075
 
2076
+ def code_days
2077
+ Duration.new(raw.days)
2078
+ end
2079
+
2080
+ def code_hours
2081
+ Duration.new(raw.hours)
2082
+ end
2083
+
2084
+ def code_minutes
2085
+ Duration.new(raw.minutes)
2086
+ end
2087
+
2088
+ def code_months
2089
+ Duration.new(::ActiveSupport::Duration.months(raw))
2090
+ end
2091
+
2092
+ def code_seconds
2093
+ Duration.new(raw.seconds)
2094
+ end
2095
+
2096
+ def code_weeks
2097
+ Duration.new(raw.weeks)
2098
+ end
2099
+
2100
+ def code_years
2101
+ Duration.new(::ActiveSupport::Duration.years(raw))
2102
+ end
2103
+
440
2104
  def code_left_shift(other)
441
2105
  code_other = other.to_code
442
2106
 
@@ -498,6 +2162,27 @@ class Code
498
2162
  String.new(raw.to_s("F"))
499
2163
  end
500
2164
 
2165
+ def code_to_fixed(digits = nil)
2166
+ code_digits = digits.to_code
2167
+ code_digits = Integer.new(0) if code_digits.nothing?
2168
+
2169
+ String.new(format("%.#{code_digits.raw}f", raw))
2170
+ end
2171
+
2172
+ def code_to_precision(precision = nil)
2173
+ code_precision = precision.to_code
2174
+ code_precision = Integer.new(raw.to_s("F").delete(".-").length) if code_precision.nothing?
2175
+
2176
+ String.new(format("%.#{code_precision.raw}g", raw))
2177
+ end
2178
+
2179
+ def code_to_exponential(digits = nil)
2180
+ code_digits = digits.to_code
2181
+ code_digits = Integer.new(6) if code_digits.nothing?
2182
+
2183
+ String.new(format("%.#{code_digits.raw}e", raw))
2184
+ end
2185
+
501
2186
  def code_truncate(n = nil)
502
2187
  code_n = n.to_code
503
2188
  code_n = Integer.new(0) if code_n.nothing?
@@ -517,6 +2202,14 @@ class Code
517
2202
  Boolean.new(raw.positive?)
518
2203
  end
519
2204
 
2205
+ def code_next_decimal
2206
+ code_next
2207
+ end
2208
+
2209
+ def code_previous_decimal
2210
+ code_previous
2211
+ end
2212
+
520
2213
  def code_positive?
521
2214
  Boolean.new(raw.positive?)
522
2215
  end
@@ -525,6 +2218,38 @@ class Code
525
2218
  Boolean.new(raw.negative?)
526
2219
  end
527
2220
 
2221
+ def code_non_zero?
2222
+ Boolean.new(!raw.zero?)
2223
+ end
2224
+
2225
+ def code_integer?
2226
+ Boolean.new(raw.frac.zero?)
2227
+ end
2228
+
2229
+ def code_finite?
2230
+ Boolean.new(raw.finite?)
2231
+ end
2232
+
2233
+ def code_infinite?
2234
+ Boolean.new(!!raw.infinite?)
2235
+ end
2236
+
2237
+ def code_not_a_number?
2238
+ Boolean.new(raw.nan?)
2239
+ end
2240
+
2241
+ def code_numerator
2242
+ Integer.new(raw.to_r.numerator)
2243
+ end
2244
+
2245
+ def code_denominator
2246
+ Integer.new(raw.to_r.denominator)
2247
+ end
2248
+
2249
+ def code_magnitude
2250
+ code_abs
2251
+ end
2252
+
528
2253
  def code_zero?
529
2254
  Boolean.new(raw.zero?)
530
2255
  end