code-ruby 4.0.0 → 4.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,7 +15,8 @@ class Code
15
15
  CLASS_FUNCTIONS = {
16
16
  "parse" => {
17
17
  name: "parse",
18
- description: "returns a value parsed from json text, or nothing when parsing fails.",
18
+ description:
19
+ "returns a value parsed from json text, or nothing when parsing fails.",
19
20
  examples: [
20
21
  "Json.parse(\"{}\")",
21
22
  "Json.parse(\"[1,2]\")",
@@ -24,7 +25,8 @@ class Code
24
25
  },
25
26
  "generate" => {
26
27
  name: "generate",
27
- description: "returns json text for a value, optionally formatted for readability.",
28
+ description:
29
+ "returns json text for a value, optionally formatted for readability.",
28
30
  examples: [
29
31
  "Json.generate({ a: 1 })",
30
32
  "Json.generate([1, 2])",
@@ -55,7 +57,10 @@ class Code
55
57
  sig(args) { [Object, { pretty: Object::Boolean.maybe }] }
56
58
 
57
59
  if code_arguments.code_second.something?
58
- code_generate(code_value, pretty: code_arguments.code_second.code_get(:pretty))
60
+ code_generate(
61
+ code_value,
62
+ pretty: code_arguments.code_second.code_get(:pretty)
63
+ )
59
64
  else
60
65
  code_generate(code_value)
61
66
  end
@@ -5,7 +5,8 @@ class Code
5
5
  class List < Object
6
6
  CLASS_DOCUMENTATION = {
7
7
  name: "List",
8
- description: "stores ordered values and provides enumerable operations.",
8
+ description:
9
+ "stores ordered values and provides enumerable operations.",
9
10
  examples: [
10
11
  "[1, 2, 3]",
11
12
  "[1, 2, 3].map((value) => { value * 2 })",
@@ -31,11 +32,7 @@ class Code
31
32
  "fetch" => {
32
33
  name: "fetch",
33
34
  description: "returns the item at an index or nothing when missing.",
34
- examples: [
35
- "[1, 2, 3].fetch(0)",
36
- "[1, 2, 3].fetch(2)",
37
- "[1].fetch(2)"
38
- ]
35
+ examples: ["[1, 2, 3].fetch(0)", "[1, 2, 3].fetch(2)", "[1].fetch(2)"]
39
36
  },
40
37
  "values_at" => {
41
38
  name: "values_at",
@@ -80,7 +77,8 @@ class Code
80
77
  },
81
78
  "sort" => {
82
79
  name: "sort",
83
- description: "returns a new list sorted by item values or function results.",
80
+ description:
81
+ "returns a new list sorted by item values or function results.",
84
82
  examples: [
85
83
  "[3, 1, 2].sort",
86
84
  "[:b, :a].sort",
@@ -89,7 +87,8 @@ class Code
89
87
  },
90
88
  "sort!" => {
91
89
  name: "sort!",
92
- description: "sorts the list in place by item values or function results.",
90
+ description:
91
+ "sorts the list in place by item values or function results.",
93
92
  examples: [
94
93
  "[3, 1, 2].sort!",
95
94
  "[:b, :a].sort!",
@@ -104,11 +103,7 @@ class Code
104
103
  "append" => {
105
104
  name: "append",
106
105
  description: "appends an item to the list and returns it.",
107
- examples: [
108
- "[1, 2].append(3)",
109
- "[].append(:a)",
110
- "[:a].append(:b)"
111
- ]
106
+ examples: ["[1, 2].append(3)", "[].append(:a)", "[:a].append(:b)"]
112
107
  },
113
108
  "push" => {
114
109
  name: "push",
@@ -118,11 +113,7 @@ class Code
118
113
  "prepend" => {
119
114
  name: "prepend",
120
115
  description: "prepends an item to the list and returns it.",
121
- examples: [
122
- "[2, 3].prepend(1)",
123
- "[].prepend(:a)",
124
- "[:b].prepend(:a)"
125
- ]
116
+ examples: ["[2, 3].prepend(1)", "[].prepend(:a)", "[:b].prepend(:a)"]
126
117
  },
127
118
  "insert" => {
128
119
  name: "insert",
@@ -159,11 +150,7 @@ class Code
159
150
  "plus" => {
160
151
  name: "plus",
161
152
  description: "returns a new list with another list appended.",
162
- examples: [
163
- "[1].plus([2])",
164
- "[].plus([:a])",
165
- "[1, 2].plus([3])"
166
- ]
153
+ examples: ["[1].plus([2])", "[].plus([:a])", "[1, 2].plus([3])"]
167
154
  },
168
155
  "-" => {
169
156
  name: "-",
@@ -181,7 +168,8 @@ class Code
181
168
  },
182
169
  "any?" => {
183
170
  name: "any?",
184
- description: "returns whether any item is present or matches a function or class.",
171
+ description:
172
+ "returns whether any item is present or matches a function or class.",
185
173
  examples: [
186
174
  "[1, 2, 3].any?",
187
175
  "[1, 2, 3].any?((x) => { x > 2 })",
@@ -199,7 +187,8 @@ class Code
199
187
  },
200
188
  "index" => {
201
189
  name: "index",
202
- description: "returns the index of an item or first item matched by a function or class.",
190
+ description:
191
+ "returns the index of an item or first item matched by a function or class.",
203
192
  examples: [
204
193
  "[:a, :b].index(:b)",
205
194
  "[1, 2, 3].index((x) => { x > 1 })",
@@ -208,7 +197,8 @@ class Code
208
197
  },
209
198
  "find_index" => {
210
199
  name: "find_index",
211
- description: "returns the index of an item or first item matched by a function or class.",
200
+ description:
201
+ "returns the index of an item or first item matched by a function or class.",
212
202
  examples: [
213
203
  "[:a, :b].find_index(:b)",
214
204
  "[1, 2, 3].find_index((x) => { x > 1 })",
@@ -217,7 +207,8 @@ class Code
217
207
  },
218
208
  "right_index" => {
219
209
  name: "right_index",
220
- description: "returns the last index of an item or of an item matched by a function or class.",
210
+ description:
211
+ "returns the last index of an item or of an item matched by a function or class.",
221
212
  examples: [
222
213
  "[:a, :b, :a].right_index(:a)",
223
214
  "[1, 2, 3].right_index((x) => { x > 1 })",
@@ -226,7 +217,8 @@ class Code
226
217
  },
227
218
  "each" => {
228
219
  name: "each",
229
- description: "calls a function or class for each item and returns the list.",
220
+ description:
221
+ "calls a function or class for each item and returns the list.",
230
222
  examples: [
231
223
  "[1, 2, 3].each((x) => { x })",
232
224
  "[:a, :b].each((x) => { x })",
@@ -235,7 +227,8 @@ class Code
235
227
  },
236
228
  "each_index" => {
237
229
  name: "each_index",
238
- description: "calls a function for each item index and returns the list.",
230
+ description:
231
+ "calls a function for each item index and returns the list.",
239
232
  examples: [
240
233
  "[1, 2, 3].each_index((i) => { i })",
241
234
  "[:a, :b].each_index((i) => { i })",
@@ -260,17 +253,29 @@ class Code
260
253
  "fourth" => {
261
254
  name: "fourth",
262
255
  description: "returns the fourth item.",
263
- examples: ["[1, 2, 3, 4].fourth", "(1..5).to_list.fourth", "[1].fourth"]
256
+ examples: [
257
+ "[1, 2, 3, 4].fourth",
258
+ "(1..5).to_list.fourth",
259
+ "[1].fourth"
260
+ ]
264
261
  },
265
262
  "fifth" => {
266
263
  name: "fifth",
267
264
  description: "returns the fifth item.",
268
- examples: ["[1, 2, 3, 4, 5].fifth", "(1..6).to_list.fifth", "[1].fifth"]
265
+ examples: [
266
+ "[1, 2, 3, 4, 5].fifth",
267
+ "(1..6).to_list.fifth",
268
+ "[1].fifth"
269
+ ]
269
270
  },
270
271
  "sixth" => {
271
272
  name: "sixth",
272
273
  description: "returns the sixth item.",
273
- examples: ["(1..6).to_list.sixth", "(1..7).to_list.sixth", "[1].sixth"]
274
+ examples: [
275
+ "(1..6).to_list.sixth",
276
+ "(1..7).to_list.sixth",
277
+ "[1].sixth"
278
+ ]
274
279
  },
275
280
  "seventh" => {
276
281
  name: "seventh",
@@ -310,7 +315,8 @@ class Code
310
315
  },
311
316
  "map" => {
312
317
  name: "map",
313
- description: "returns a new list with each item transformed by a function or class.",
318
+ description:
319
+ "returns a new list with each item transformed by a function or class.",
314
320
  examples: [
315
321
  "[1, 2, 3].map(Integer)",
316
322
  "[:1, :2].map(Integer)",
@@ -343,7 +349,8 @@ class Code
343
349
  },
344
350
  "delete" => {
345
351
  name: "delete",
346
- description: "removes matching items from the list and returns the removed value.",
352
+ description:
353
+ "removes matching items from the list and returns the removed value.",
347
354
  examples: [
348
355
  "[1, 2, 2].delete(2)",
349
356
  "[:a, :b].delete(:a)",
@@ -361,7 +368,8 @@ class Code
361
368
  },
362
369
  "delete_if" => {
363
370
  name: "delete_if",
364
- description: "removes items matched by a function or class and returns the list.",
371
+ description:
372
+ "removes items matched by a function or class and returns the list.",
365
373
  examples: [
366
374
  "[1, 2, 3].delete_if((x) => { x > 1 })",
367
375
  "[:a, :b].delete_if((x) => { x == :a })",
@@ -370,7 +378,8 @@ class Code
370
378
  },
371
379
  "keep_if" => {
372
380
  name: "keep_if",
373
- description: "keeps items matched by a function or class and returns the list.",
381
+ description:
382
+ "keeps items matched by a function or class and returns the list.",
374
383
  examples: [
375
384
  "[1, 2, 3].keep_if((x) => { x > 1 })",
376
385
  "[:a, :b].keep_if((x) => { x == :a })",
@@ -379,7 +388,8 @@ class Code
379
388
  },
380
389
  "pop" => {
381
390
  name: "pop",
382
- description: "returns the last item or last items without mutating the list.",
391
+ description:
392
+ "returns the last item or last items without mutating the list.",
383
393
  examples: ["[1, 2, 3].pop", "[1, 2, 3].pop(2)", "[].pop"]
384
394
  },
385
395
  "pop!" => {
@@ -446,11 +456,7 @@ class Code
446
456
  "zip" => {
447
457
  name: "zip",
448
458
  description: "returns a list by zipping items with other lists.",
449
- examples: [
450
- "[1, 2].zip([3, 4])",
451
- "[:a, :b].zip([1, 2])",
452
- "[].zip([])"
453
- ]
459
+ examples: ["[1, 2].zip([3, 4])", "[:a, :b].zip([1, 2])", "[].zip([])"]
454
460
  },
455
461
  "map!" => {
456
462
  name: "map!",
@@ -478,20 +484,12 @@ class Code
478
484
  "maximum" => {
479
485
  name: "maximum",
480
486
  description: "returns the maximum item.",
481
- examples: [
482
- "[1, 3, 2].maximum",
483
- "[:a, :b].maximum",
484
- "[].maximum"
485
- ]
487
+ examples: ["[1, 3, 2].maximum", "[:a, :b].maximum", "[].maximum"]
486
488
  },
487
489
  "minimum" => {
488
490
  name: "minimum",
489
491
  description: "returns the minimum item.",
490
- examples: [
491
- "[1, 3, 2].minimum",
492
- "[:a, :b].minimum",
493
- "[].minimum"
494
- ]
492
+ examples: ["[1, 3, 2].minimum", "[:a, :b].minimum", "[].minimum"]
495
493
  },
496
494
  "minimum_maximum" => {
497
495
  name: "minimum_maximum",
@@ -504,7 +502,8 @@ class Code
504
502
  },
505
503
  "none?" => {
506
504
  name: "none?",
507
- description: "returns whether no items are present or match a function or class.",
505
+ description:
506
+ "returns whether no items are present or match a function or class.",
508
507
  examples: [
509
508
  "[].none?",
510
509
  "[1, 2, 3].none?((x) => { x > 3 })",
@@ -513,7 +512,8 @@ class Code
513
512
  },
514
513
  "all?" => {
515
514
  name: "all?",
516
- description: "returns whether all items are present or match a function or class.",
515
+ description:
516
+ "returns whether all items are present or match a function or class.",
517
517
  examples: [
518
518
  "[1, 2, 3].all?",
519
519
  "[1, 2, 3].all?((x) => { x > 0 })",
@@ -531,7 +531,8 @@ class Code
531
531
  },
532
532
  "group" => {
533
533
  name: "group",
534
- description: "returns a dictionary grouping items by a function result or class match.",
534
+ description:
535
+ "returns a dictionary grouping items by a function result or class match.",
535
536
  examples: [
536
537
  "[1, 2, 3].group((x) => { x.even? })",
537
538
  "[:a, :b].group(String)",
@@ -549,7 +550,8 @@ class Code
549
550
  },
550
551
  "cycle" => {
551
552
  name: "cycle",
552
- description: "returns cycled items or calls a function for each cycled item.",
553
+ description:
554
+ "returns cycled items or calls a function for each cycled item.",
553
555
  examples: [
554
556
  "[1, 2].cycle(2)",
555
557
  "[1, 2].cycle(2, (x) => { x })",
@@ -676,7 +678,8 @@ class Code
676
678
  },
677
679
  "intersect?" => {
678
680
  name: "intersect?",
679
- description: "returns whether the list shares items with another list.",
681
+ description:
682
+ "returns whether the list shares items with another list.",
680
683
  examples: [
681
684
  "[1, 2].intersect?([2, 3])",
682
685
  "[:a].intersect?([:b])",
@@ -685,7 +688,8 @@ class Code
685
688
  },
686
689
  "associate" => {
687
690
  name: "associate",
688
- description: "returns the first nested list whose first item matches a value.",
691
+ description:
692
+ "returns the first nested list whose first item matches a value.",
689
693
  examples: [
690
694
  "[[:a, 1], [:b, 2]].associate(:a)",
691
695
  "[[1, :a], [2, :b]].associate(2)",
@@ -694,7 +698,8 @@ class Code
694
698
  },
695
699
  "right_associate" => {
696
700
  name: "right_associate",
697
- description: "returns the first nested list whose second item matches a value.",
701
+ description:
702
+ "returns the first nested list whose second item matches a value.",
698
703
  examples: [
699
704
  "[[1, :a], [2, :b]].right_associate(:a)",
700
705
  "[[:a, 1], [:b, 2]].right_associate(2)",
@@ -721,7 +726,8 @@ class Code
721
726
  },
722
727
  "select!" => {
723
728
  name: "select!",
724
- description: "keeps items matched by a function or class and returns the list.",
729
+ description:
730
+ "keeps items matched by a function or class and returns the list.",
725
731
  examples: [
726
732
  "[1, 2, 3].select!((x) => { x > 1 })",
727
733
  "[1, :a, 2].select!(Integer)",
@@ -730,7 +736,8 @@ class Code
730
736
  },
731
737
  "filter!" => {
732
738
  name: "filter!",
733
- description: "keeps items matched by a function or class and returns the list.",
739
+ description:
740
+ "keeps items matched by a function or class and returns the list.",
734
741
  examples: [
735
742
  "[1, 2, 3].filter!((x) => { x > 1 })",
736
743
  "[1, :a, 2].filter!(Integer)",
@@ -739,7 +746,8 @@ class Code
739
746
  },
740
747
  "compact" => {
741
748
  name: "compact",
742
- description: "returns a new list without nothing values or matched items.",
749
+ description:
750
+ "returns a new list without nothing values or matched items.",
743
751
  examples: [
744
752
  "[1, nothing, 2].compact",
745
753
  "[1, :a, 2].compact(String)",
@@ -748,7 +756,8 @@ class Code
748
756
  },
749
757
  "compact!" => {
750
758
  name: "compact!",
751
- description: "removes nothing values or matched items in place and returns the list.",
759
+ description:
760
+ "removes nothing values or matched items in place and returns the list.",
752
761
  examples: [
753
762
  "[1, nothing, 2].compact!",
754
763
  "[1, :a, 2].compact!(String)",
@@ -766,7 +775,8 @@ class Code
766
775
  },
767
776
  "reject!" => {
768
777
  name: "reject!",
769
- description: "removes items matched by a function or class and returns the list.",
778
+ description:
779
+ "removes items matched by a function or class and returns the list.",
770
780
  examples: [
771
781
  "[1, 2, 3].reject!((x) => { x > 1 })",
772
782
  "[1, :a, 2].reject!(Integer)",
@@ -805,11 +815,7 @@ class Code
805
815
  "tally" => {
806
816
  name: "tally",
807
817
  description: "returns a dictionary counting each item.",
808
- examples: [
809
- "[:a, :b, :a].tally",
810
- "[1, 1, 2].tally",
811
- "[].tally"
812
- ]
818
+ examples: ["[:a, :b, :a].tally", "[1, 1, 2].tally", "[].tally"]
813
819
  },
814
820
  "entries" => {
815
821
  name: "entries",
@@ -818,7 +824,8 @@ class Code
818
824
  },
819
825
  "to_dictionary" => {
820
826
  name: "to_dictionary",
821
- description: "converts the list to a dictionary using entry pairs or indexes.",
827
+ description:
828
+ "converts the list to a dictionary using entry pairs or indexes.",
822
829
  examples: [
823
830
  "[[:a, 1], [:b, 2]].to_dictionary",
824
831
  "[\"a\", \"b\"].to_dictionary",
@@ -1680,29 +1687,17 @@ class Code
1680
1687
  "zero?" => {
1681
1688
  name: "zero?",
1682
1689
  description: "returns whether the list size is zero.",
1683
- examples: [
1684
- "(1..0).to_list.zero?",
1685
- "(1..1).to_list.zero?",
1686
- "[].zero?"
1687
- ]
1690
+ examples: ["(1..0).to_list.zero?", "(1..1).to_list.zero?", "[].zero?"]
1688
1691
  },
1689
1692
  "one?" => {
1690
1693
  name: "one?",
1691
1694
  description: "returns whether the list size is one.",
1692
- examples: [
1693
- "(1..1).to_list.one?",
1694
- "(1..2).to_list.one?",
1695
- "[].one?"
1696
- ]
1695
+ examples: ["(1..1).to_list.one?", "(1..2).to_list.one?", "[].one?"]
1697
1696
  },
1698
1697
  "two?" => {
1699
1698
  name: "two?",
1700
1699
  description: "returns whether the list size is two.",
1701
- examples: [
1702
- "(1..2).to_list.two?",
1703
- "(1..3).to_list.two?",
1704
- "[].two?"
1705
- ]
1700
+ examples: ["(1..2).to_list.two?", "(1..3).to_list.two?", "[].two?"]
1706
1701
  },
1707
1702
  "three?" => {
1708
1703
  name: "three?",
@@ -1716,29 +1711,17 @@ class Code
1716
1711
  "four?" => {
1717
1712
  name: "four?",
1718
1713
  description: "returns whether the list size is four.",
1719
- examples: [
1720
- "(1..4).to_list.four?",
1721
- "(1..5).to_list.four?",
1722
- "[].four?"
1723
- ]
1714
+ examples: ["(1..4).to_list.four?", "(1..5).to_list.four?", "[].four?"]
1724
1715
  },
1725
1716
  "five?" => {
1726
1717
  name: "five?",
1727
1718
  description: "returns whether the list size is five.",
1728
- examples: [
1729
- "(1..5).to_list.five?",
1730
- "(1..6).to_list.five?",
1731
- "[].five?"
1732
- ]
1719
+ examples: ["(1..5).to_list.five?", "(1..6).to_list.five?", "[].five?"]
1733
1720
  },
1734
1721
  "six?" => {
1735
1722
  name: "six?",
1736
1723
  description: "returns whether the list size is six.",
1737
- examples: [
1738
- "(1..6).to_list.six?",
1739
- "(1..7).to_list.six?",
1740
- "[].six?"
1741
- ]
1724
+ examples: ["(1..6).to_list.six?", "(1..7).to_list.six?", "[].six?"]
1742
1725
  },
1743
1726
  "seven?" => {
1744
1727
  name: "seven?",
@@ -1770,11 +1753,7 @@ class Code
1770
1753
  "ten?" => {
1771
1754
  name: "ten?",
1772
1755
  description: "returns whether the list size is ten.",
1773
- examples: [
1774
- "(1..10).to_list.ten?",
1775
- "(1..11).to_list.ten?",
1776
- "[].ten?"
1777
- ]
1756
+ examples: ["(1..10).to_list.ten?", "(1..11).to_list.ten?", "[].ten?"]
1778
1757
  },
1779
1758
  "eleven?" => {
1780
1759
  name: "eleven?",
@@ -3729,7 +3708,8 @@ class Code
3729
3708
  e.code_value.truthy?
3730
3709
  end
3731
3710
  elsif code_argument.is_a?(Class)
3732
- index = raw.index { |code_element| code_element.is_a?(code_argument.raw) }
3711
+ index =
3712
+ raw.index { |code_element| code_element.is_a?(code_argument.raw) }
3733
3713
  else
3734
3714
  index = raw.index(code_argument)
3735
3715
  end
@@ -4695,7 +4675,9 @@ class Code
4695
4675
 
4696
4676
  def code_combination(size)
4697
4677
  code_size = size.to_code
4698
- List.new(raw.combination(code_size.raw).map { |values| List.new(values) })
4678
+ List.new(
4679
+ raw.combination(code_size.raw).map { |values| List.new(values) }
4680
+ )
4699
4681
  end
4700
4682
 
4701
4683
  def code_permutation(size = nil)
@@ -5003,7 +4985,11 @@ class Code
5003
4985
  if code_argument.nothing?
5004
4986
  return Integer.new(raw.count)
5005
4987
  elsif code_argument.is_a?(Class)
5006
- return Integer.new(raw.count { |element| element.is_a?(code_argument.raw) })
4988
+ return(
4989
+ Integer.new(
4990
+ raw.count { |element| element.is_a?(code_argument.raw) }
4991
+ )
4992
+ )
5007
4993
  end
5008
4994
 
5009
4995
  index = 0
@@ -5080,7 +5066,9 @@ class Code
5080
5066
 
5081
5067
  duplicate = List.new
5082
5068
  seen[self] = duplicate
5083
- duplicate.raw.concat(raw.map { |value| value.code_deep_duplicate(seen) })
5069
+ duplicate.raw.concat(
5070
+ raw.map { |value| value.code_deep_duplicate(seen) }
5071
+ )
5084
5072
  duplicate
5085
5073
  end
5086
5074
 
@@ -6,31 +6,31 @@ class Code
6
6
  CLASS_DOCUMENTATION = {
7
7
  name: "Nothing",
8
8
  description: "represents no value.",
9
- examples: [
10
- "nothing",
11
- "Nothing.new",
12
- "Nothing.new(1)"
13
- ]
9
+ examples: %w[nothing Nothing.new Nothing.new(1)]
14
10
  }.freeze
15
11
  INSTANCE_FUNCTIONS = {
16
12
  "empty?" => {
17
13
  name: "empty?",
18
14
  description: "returns true because nothing has no contents.",
19
- examples: ["nothing.empty?", "Nothing.new.empty?", "Nothing.new(1).empty?"]
15
+ examples: %w[nothing.empty? Nothing.new.empty? Nothing.new(1).empty?]
20
16
  },
21
17
  "to_string" => {
22
18
  name: "to_string",
23
19
  description: "returns an empty string for nothing.",
24
- examples: [
25
- "nothing.to_string",
26
- "Nothing.new.to_string",
27
- "Nothing.new(1).to_string"
20
+ examples: %w[
21
+ nothing.to_string
22
+ Nothing.new.to_string
23
+ Nothing.new(1).to_string
28
24
  ]
29
25
  },
30
26
  "inspect" => {
31
27
  name: "inspect",
32
28
  description: "returns the source string for nothing.",
33
- examples: ["nothing.inspect", "Nothing.new.inspect", "Nothing.new(1).inspect"]
29
+ examples: %w[
30
+ nothing.inspect
31
+ Nothing.new.inspect
32
+ Nothing.new(1).inspect
33
+ ]
34
34
  }
35
35
  }.freeze
36
36
 
@@ -5,7 +5,8 @@ class Code
5
5
  class Number < Object
6
6
  CLASS_DOCUMENTATION = {
7
7
  name: "Number",
8
- description: "represents numeric behavior shared by integers and decimals.",
8
+ description:
9
+ "represents numeric behavior shared by integers and decimals.",
9
10
  examples: [
10
11
  "Number.documentation.name",
11
12
  "Number.instance_functions.keys.include?(:between?)",
@@ -16,7 +17,11 @@ class Code
16
17
  "between?" => {
17
18
  name: "between?",
18
19
  description: "returns whether the number is within inclusive bounds.",
19
- examples: ["2.between?(1, 3)", "1.5.between?(1, 2)", "4.between?(1, 3)"]
20
+ examples: [
21
+ "2.between?(1, 3)",
22
+ "1.5.between?(1, 2)",
23
+ "4.between?(1, 3)"
24
+ ]
20
25
  },
21
26
  "clamp" => {
22
27
  name: "clamp",
@@ -25,38 +30,43 @@ class Code
25
30
  },
26
31
  "divide" => {
27
32
  name: "divide",
28
- description: "returns floor division of the number by another number.",
29
- examples: ["5.divide(2)", "10.divide(3)", "9.5.divide(2)"]
33
+ description:
34
+ "returns floor division of the number by another number.",
35
+ examples: %w[5.divide(2) 10.divide(3) 9.5.divide(2)]
30
36
  },
31
37
  "divide_modulo" => {
32
38
  name: "divide_modulo",
33
39
  description: "returns floor division and modulo as a list.",
34
- examples: ["5.divide_modulo(2)", "10.divide_modulo(3)", "9.5.divide_modulo(2)"]
40
+ examples: %w[
41
+ 5.divide_modulo(2)
42
+ 10.divide_modulo(3)
43
+ 9.5.divide_modulo(2)
44
+ ]
35
45
  },
36
46
  "next" => {
37
47
  name: "next",
38
48
  description: "returns the number plus one.",
39
- examples: ["1.next", "1.5.next", "-1.next"]
49
+ examples: %w[1.next 1.5.next -1.next]
40
50
  },
41
51
  "successor" => {
42
52
  name: "successor",
43
53
  description: "returns the number plus one, matching next.",
44
- examples: ["1.successor", "1.5.successor", "-1.successor"]
54
+ examples: %w[1.successor 1.5.successor -1.successor]
45
55
  },
46
56
  "previous" => {
47
57
  name: "previous",
48
58
  description: "returns the number minus one.",
49
- examples: ["1.previous", "1.5.previous", "-1.previous"]
59
+ examples: %w[1.previous 1.5.previous -1.previous]
50
60
  },
51
61
  "predecessor" => {
52
62
  name: "predecessor",
53
63
  description: "returns the number minus one, matching previous.",
54
- examples: ["1.predecessor", "1.5.predecessor", "-1.predecessor"]
64
+ examples: %w[1.predecessor 1.5.predecessor -1.predecessor]
55
65
  },
56
66
  "remainder" => {
57
67
  name: "remainder",
58
68
  description: "returns the remainder from division by another number.",
59
- examples: ["5.remainder(2)", "10.remainder(3)", "9.5.remainder(2)"]
69
+ examples: %w[5.remainder(2) 10.remainder(3) 9.5.remainder(2)]
60
70
  }
61
71
  }.freeze
62
72