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.
@@ -5,7 +5,8 @@ class Code
5
5
  class Parameter < Dictionary
6
6
  CLASS_DOCUMENTATION = {
7
7
  name: "Parameter",
8
- description: "describes one function parameter with its name, kind flags, and default value.",
8
+ description:
9
+ "describes one function parameter with its name, kind flags, and default value.",
9
10
  examples: [
10
11
  "((name) => { name }).parameters.first",
11
12
  "((name:) => { name }).parameters.first.keyword?",
@@ -24,7 +25,8 @@ class Code
24
25
  },
25
26
  "regular?" => {
26
27
  name: "regular?",
27
- description: "returns whether the parameter is not a keyword parameter.",
28
+ description:
29
+ "returns whether the parameter is not a keyword parameter.",
28
30
  examples: [
29
31
  "((name) => { name }).parameters.first.regular?",
30
32
  "((name:) => { name }).parameters.first.regular?",
@@ -33,7 +35,8 @@ class Code
33
35
  },
34
36
  "keyword?" => {
35
37
  name: "keyword?",
36
- description: "returns whether the parameter is a named keyword parameter.",
38
+ description:
39
+ "returns whether the parameter is a named keyword parameter.",
37
40
  examples: [
38
41
  "((name:) => { name }).parameters.first.keyword?",
39
42
  "((name) => { name }).parameters.first.keyword?",
@@ -42,7 +45,8 @@ class Code
42
45
  },
43
46
  "regular_splat?" => {
44
47
  name: "regular_splat?",
45
- description: "returns whether the parameter captures positional arguments with *.",
48
+ description:
49
+ "returns whether the parameter captures positional arguments with *.",
46
50
  examples: [
47
51
  "((...values) => { values }).parameters.first.regular_splat?",
48
52
  "((*values) => { values }).parameters.first.regular_splat?",
@@ -51,7 +55,8 @@ class Code
51
55
  },
52
56
  "keyword_splat?" => {
53
57
  name: "keyword_splat?",
54
- description: "returns whether the parameter captures keyword arguments with **.",
58
+ description:
59
+ "returns whether the parameter captures keyword arguments with **.",
55
60
  examples: [
56
61
  "((**options) => { options }).parameters.first.keyword_splat?",
57
62
  "((name:) => { name }).parameters.first.keyword_splat?",
@@ -60,7 +65,8 @@ class Code
60
65
  },
61
66
  "block?" => {
62
67
  name: "block?",
63
- description: "returns whether the parameter captures one function argument with &.",
68
+ description:
69
+ "returns whether the parameter captures one function argument with &.",
64
70
  examples: [
65
71
  "((&block) => { block }).parameters.first.block?",
66
72
  "((name) => { name }).parameters.first.block?",
@@ -69,7 +75,8 @@ class Code
69
75
  },
70
76
  "blocks?" => {
71
77
  name: "blocks?",
72
- description: "returns whether the parameter captures remaining function arguments with &&.",
78
+ description:
79
+ "returns whether the parameter captures remaining function arguments with &&.",
73
80
  examples: [
74
81
  "((&&blocks) => { blocks }).parameters.first.blocks?",
75
82
  "((&block) => { block }).parameters.first.blocks?",
@@ -78,7 +85,8 @@ class Code
78
85
  },
79
86
  "spread?" => {
80
87
  name: "spread?",
81
- description: "returns whether the parameter captures every provided argument with spread syntax.",
88
+ description:
89
+ "returns whether the parameter captures every provided argument with spread syntax.",
82
90
  examples: [
83
91
  "((...values) => { values }).parameters.first.spread?",
84
92
  "((name) => { name }).parameters.first.spread?",
@@ -105,7 +113,8 @@ class Code
105
113
  },
106
114
  "default" => {
107
115
  name: "default",
108
- description: "returns the default value for the parameter, or nothing when none is set.",
116
+ description:
117
+ "returns the default value for the parameter, or nothing when none is set.",
109
118
  examples: [
110
119
  "((name = :a) => { name }).parameters.first.default",
111
120
  "((name) => { name }).parameters.first.default",
@@ -5,17 +5,15 @@ class Code
5
5
  class Range < Object
6
6
  CLASS_DOCUMENTATION = {
7
7
  name: "Range",
8
- description: "represents inclusive or exclusive sequences between comparable bounds.",
9
- examples: [
10
- "1..3",
11
- "1...3",
12
- "(1..3).to_list"
13
- ]
8
+ description:
9
+ "represents inclusive or exclusive sequences between comparable bounds.",
10
+ examples: %w[1..3 1...3 (1..3).to_list]
14
11
  }.freeze
15
12
  INSTANCE_FUNCTIONS = {
16
13
  "all?" => {
17
14
  name: "all?",
18
- description: "returns whether every item in the range matches a function.",
15
+ description:
16
+ "returns whether every item in the range matches a function.",
19
17
  examples: [
20
18
  "(1..3).all?((x) => { x > 0 })",
21
19
  "(1..3).all?((x) => { x < 4 })",
@@ -24,7 +22,8 @@ class Code
24
22
  },
25
23
  "any?" => {
26
24
  name: "any?",
27
- description: "returns whether any item in the range matches a function.",
25
+ description:
26
+ "returns whether any item in the range matches a function.",
28
27
  examples: [
29
28
  "(1..3).any?((x) => { x == 2 })",
30
29
  "(1..3).any?((x) => { x == 1 })",
@@ -33,7 +32,8 @@ class Code
33
32
  },
34
33
  "none?" => {
35
34
  name: "none?",
36
- description: "returns whether no items in the range match a function.",
35
+ description:
36
+ "returns whether no items in the range match a function.",
37
37
  examples: [
38
38
  "(1..3).none?((x) => { x > 3 })",
39
39
  "(1..3).none?((x) => { x == 2 })",
@@ -42,7 +42,8 @@ class Code
42
42
  },
43
43
  "each" => {
44
44
  name: "each",
45
- description: "calls a function for each item in the range and returns the range.",
45
+ description:
46
+ "calls a function for each item in the range and returns the range.",
46
47
  examples: [
47
48
  "(1..3).each((x) => { x })",
48
49
  "(:a..:c).each((x) => { x })",
@@ -51,7 +52,8 @@ class Code
51
52
  },
52
53
  "reverse_each" => {
53
54
  name: "reverse_each",
54
- description: "calls a function for each item in the range in reverse order.",
55
+ description:
56
+ "calls a function for each item in the range in reverse order.",
55
57
  examples: [
56
58
  "(1..3).reverse_each((x) => { x })",
57
59
  "(:a..:c).reverse_each((x) => { x })",
@@ -61,123 +63,88 @@ class Code
61
63
  "include?" => {
62
64
  name: "include?",
63
65
  description: "returns whether the range includes a value.",
64
- examples: [
65
- "(1..3).include?(2)",
66
- "(1..3).include?(4)",
67
- "(:a..:c).include?(:b)"
66
+ examples: %w[
67
+ (1..3).include?(2)
68
+ (1..3).include?(4)
69
+ (:a..:c).include?(:b)
68
70
  ]
69
71
  },
70
72
  "member?" => {
71
73
  name: "member?",
72
74
  description: "returns whether the range includes a value.",
73
- examples: [
74
- "(1..3).member?(2)",
75
- "(1..3).member?(4)",
76
- "(:a..:c).member?(:b)"
77
- ]
75
+ examples: %w[(1..3).member?(2) (1..3).member?(4) (:a..:c).member?(:b)]
78
76
  },
79
77
  "cover?" => {
80
78
  name: "cover?",
81
79
  description: "returns whether a value is between the range bounds.",
82
- examples: [
83
- "(1..3).cover?(2)",
84
- "(1..3).cover?(4)",
85
- "(:a..:c).cover?(:b)"
86
- ]
80
+ examples: %w[(1..3).cover?(2) (1..3).cover?(4) (:a..:c).cover?(:b)]
87
81
  },
88
82
  "overlap?" => {
89
83
  name: "overlap?",
90
84
  description: "returns whether the range overlaps another range.",
91
- examples: [
92
- "(1..3).overlap?(2..4)",
93
- "(1..3).overlap?(4..6)",
94
- "(:a..:c).overlap?(:b..:d)"
85
+ examples: %w[
86
+ (1..3).overlap?(2..4)
87
+ (1..3).overlap?(4..6)
88
+ (:a..:c).overlap?(:b..:d)
95
89
  ]
96
90
  },
97
91
  "empty?" => {
98
92
  name: "empty?",
99
93
  description: "returns whether the range is empty.",
100
- examples: [
101
- "(1..3).empty?",
102
- "(1...1).empty?",
103
- "(:a..:c).empty?"
104
- ]
94
+ examples: %w[(1..3).empty? (1...1).empty? (:a..:c).empty?]
105
95
  },
106
96
  "begin" => {
107
97
  name: "begin",
108
98
  description: "returns the starting bound of the range.",
109
- examples: [
110
- "(1..3).begin",
111
- "(:a..:c).begin",
112
- "(1...3).begin"
113
- ]
99
+ examples: %w[(1..3).begin (:a..:c).begin (1...3).begin]
114
100
  },
115
101
  "end" => {
116
102
  name: "end",
117
103
  description: "returns the ending bound of the range.",
118
- examples: [
119
- "(1..3).end",
120
- "(:a..:c).end",
121
- "(1...3).end"
122
- ]
104
+ examples: %w[(1..3).end (:a..:c).end (1...3).end]
123
105
  },
124
106
  "exclude_end?" => {
125
107
  name: "exclude_end?",
126
108
  description: "returns whether the range excludes its ending bound.",
127
- examples: [
128
- "(1..3).exclude_end?",
129
- "(1...3).exclude_end?",
130
- "(:a...:c).exclude_end?"
109
+ examples: %w[
110
+ (1..3).exclude_end?
111
+ (1...3).exclude_end?
112
+ (:a...:c).exclude_end?
131
113
  ]
132
114
  },
133
115
  "first" => {
134
116
  name: "first",
135
117
  description: "returns the first item in the range.",
136
- examples: [
137
- "(1..3).first",
138
- "(2..4).first",
139
- "(:a..:c).first"
140
- ]
118
+ examples: %w[(1..3).first (2..4).first (:a..:c).first]
141
119
  },
142
120
  "last" => {
143
121
  name: "last",
144
122
  description: "returns the last item in the range.",
145
- examples: [
146
- "(1..3).last",
147
- "(2..4).last",
148
- "(:a..:c).last"
149
- ]
123
+ examples: %w[(1..3).last (2..4).last (:a..:c).last]
150
124
  },
151
125
  "minimum" => {
152
126
  name: "minimum",
153
127
  description: "returns the minimum item in the range.",
154
- examples: [
155
- "(1..3).minimum",
156
- "(:a..:c).minimum",
157
- "(3..1).minimum"
158
- ]
128
+ examples: %w[(1..3).minimum (:a..:c).minimum (3..1).minimum]
159
129
  },
160
130
  "maximum" => {
161
131
  name: "maximum",
162
132
  description: "returns the maximum item in the range.",
163
- examples: [
164
- "(1..3).maximum",
165
- "(:a..:c).maximum",
166
- "(3..1).maximum"
167
- ]
133
+ examples: %w[(1..3).maximum (:a..:c).maximum (3..1).maximum]
168
134
  },
169
135
  "minimum_maximum" => {
170
136
  name: "minimum_maximum",
171
137
  description: "returns the minimum and maximum items as a list.",
172
- examples: [
173
- "(1..3).minimum_maximum",
174
- "(:a..:c).minimum_maximum",
175
- "(3..1).minimum_maximum"
138
+ examples: %w[
139
+ (1..3).minimum_maximum
140
+ (:a..:c).minimum_maximum
141
+ (3..1).minimum_maximum
176
142
  ]
177
143
  },
178
144
  "map" => {
179
145
  name: "map",
180
- description: "returns a list with each item transformed by a function.",
146
+ description:
147
+ "returns a list with each item transformed by a function.",
181
148
  examples: [
182
149
  "(1..3).map((x) => { x + 1 })",
183
150
  "(1..3).map((x) => { x.to_string })",
@@ -214,11 +181,7 @@ class Code
214
181
  "step" => {
215
182
  name: "step",
216
183
  description: "returns a list of items separated by a step size.",
217
- examples: [
218
- "(1..5).step(2)",
219
- "(1..5).step(1)",
220
- "(1...5).step(2)"
221
- ]
184
+ examples: %w[(1..5).step(2) (1..5).step(1) (1...5).step(2)]
222
185
  },
223
186
  "binary_search" => {
224
187
  name: "binary_search",
@@ -232,24 +195,17 @@ class Code
232
195
  "sample" => {
233
196
  name: "sample",
234
197
  description: "returns a random item from the range.",
235
- examples: [
236
- "(1..3).sample",
237
- "(2..4).sample",
238
- "(:a..:c).sample"
239
- ]
198
+ examples: %w[(1..3).sample (2..4).sample (:a..:c).sample]
240
199
  },
241
200
  "size" => {
242
201
  name: "size",
243
202
  description: "returns the number of items in the range.",
244
- examples: [
245
- "(1..3).size",
246
- "(1...3).size",
247
- "(:a..:c).size"
248
- ]
203
+ examples: %w[(1..3).size (1...3).size (:a..:c).size]
249
204
  },
250
205
  "count" => {
251
206
  name: "count",
252
- description: "returns the number of items, optionally matched by a function.",
207
+ description:
208
+ "returns the number of items, optionally matched by a function.",
253
209
  examples: [
254
210
  "(1..3).count",
255
211
  "(1...3).count",
@@ -259,28 +215,20 @@ class Code
259
215
  "to_list" => {
260
216
  name: "to_list",
261
217
  description: "returns the range items as a list.",
262
- examples: [
263
- "(1..3).to_list",
264
- "(1...3).to_list",
265
- "(:a..:c).to_list"
266
- ]
218
+ examples: %w[(1..3).to_list (1...3).to_list (:a..:c).to_list]
267
219
  },
268
220
  "entries" => {
269
221
  name: "entries",
270
222
  description: "returns the range items as a list.",
271
- examples: [
272
- "(1..3).entries",
273
- "(1...3).entries",
274
- "(:a..:c).entries"
275
- ]
223
+ examples: %w[(1..3).entries (1...3).entries (:a..:c).entries]
276
224
  },
277
225
  "to_dictionary" => {
278
226
  name: "to_dictionary",
279
227
  description: "returns a dictionary built from indexed range items.",
280
- examples: [
281
- "(1..3).to_dictionary",
282
- "(1...3).to_dictionary",
283
- "(:a..:c).to_dictionary"
228
+ examples: %w[
229
+ (1..3).to_dictionary
230
+ (1...3).to_dictionary
231
+ (:a..:c).to_dictionary
284
232
  ]
285
233
  }
286
234
  }.freeze
@@ -707,9 +655,17 @@ class Code
707
655
  loop do
708
656
  comparison =
709
657
  if step_is_positive
710
- exclude_end? ? code_element.code_less(code_right) : code_element.code_less_or_equal(code_right)
658
+ if exclude_end?
659
+ code_element.code_less(code_right)
660
+ else
661
+ code_element.code_less_or_equal(code_right)
662
+ end
711
663
  else
712
- exclude_end? ? code_element.code_greater(code_right) : code_element.code_greater_or_equal(code_right)
664
+ if exclude_end?
665
+ code_element.code_greater(code_right)
666
+ else
667
+ code_element.code_greater_or_equal(code_right)
668
+ end
713
669
  end
714
670
 
715
671
  break unless comparison.truthy?
@@ -755,9 +711,7 @@ class Code
755
711
  def code_count(argument = nil, **globals)
756
712
  code_argument = argument.to_code
757
713
 
758
- if code_argument.nothing?
759
- return Integer.new(raw.to_a.size)
760
- end
714
+ return Integer.new(raw.to_a.size) if code_argument.nothing?
761
715
 
762
716
  index = 0
763
717
  Integer.new(
@@ -6,20 +6,16 @@ class Code
6
6
  CLASS_DOCUMENTATION = {
7
7
  name: "Smtp",
8
8
  description: "stores smtp settings and sends email messages.",
9
- examples: [
10
- "Smtp",
11
- "Smtp.new",
12
- "Smtp.new.functions.keys.include?(:send)"
13
- ]
9
+ examples: %w[Smtp Smtp.new Smtp.new.functions.keys.include?(:send)]
14
10
  }.freeze
15
11
  INSTANCE_FUNCTIONS = {
16
12
  "send" => {
17
13
  name: "send",
18
14
  description: "sends an email using the receiver's smtp settings.",
19
- examples: [
20
- "Smtp.new.respond_to?(:send)",
21
- "Smtp.new.functions.keys.include?(:send)",
22
- "Smtp.new.instance_functions.keys.include?(:send)"
15
+ examples: %w[
16
+ Smtp.new.respond_to?(:send)
17
+ Smtp.new.functions.keys.include?(:send)
18
+ Smtp.new.instance_functions.keys.include?(:send)
23
19
  ]
24
20
  }
25
21
  }.freeze
@@ -127,14 +123,23 @@ class Code
127
123
  private
128
124
 
129
125
  def validate_delivery_target!(address, port)
130
- resolved_ip = ::Code::Network.validate_public_host!(address, service: "smtp").first
126
+ resolved_ip =
127
+ ::Code::Network.validate_public_host!(address, service: "smtp").first
131
128
 
132
129
  return resolved_ip if ALLOWED_PORTS.include?(port)
133
130
 
134
131
  raise Error, "smtp: unsupported port"
135
132
  end
136
133
 
137
- def deliver_mail(mail, address:, resolved_ip:, port:, user_name:, password:, authentication:)
134
+ def deliver_mail(
135
+ mail,
136
+ address:,
137
+ resolved_ip:,
138
+ port:,
139
+ user_name:,
140
+ password:,
141
+ authentication:
142
+ )
138
143
  envelope = Mail::SmtpEnvelope.new(mail)
139
144
  smtp =
140
145
  Net::SMTP.new(
@@ -161,7 +166,10 @@ class Code
161
166
  end
162
167
  rescue Timeout::Error
163
168
  raise Error, "smtp timeout"
164
- rescue OpenSSL::SSL::SSLError, IOError, SystemCallError, SocketError,
169
+ rescue OpenSSL::SSL::SSLError,
170
+ IOError,
171
+ SystemCallError,
172
+ SocketError,
165
173
  Net::SMTPError
166
174
  raise Error, "smtp error"
167
175
  end
@@ -5,12 +5,9 @@ class Code
5
5
  class String < Object
6
6
  CLASS_DOCUMENTATION = {
7
7
  name: "String",
8
- description: "represents text and provides parsing, search, and transformation operations.",
9
- examples: [
10
- "\"hello\"",
11
- ":hello.upcase",
12
- "\"a,b\".split(\",\")"
13
- ]
8
+ description:
9
+ "represents text and provides parsing, search, and transformation operations.",
10
+ examples: ["\"hello\"", ":hello.upcase", "\"a,b\".split(\",\")"]
14
11
  }.freeze
15
12
  INSTANCE_FUNCTIONS = {
16
13
  "&" => {
@@ -40,7 +37,11 @@ class Code
40
37
  "downcase" => {
41
38
  name: "downcase",
42
39
  description: "returns the string converted to lowercase.",
43
- examples: ["\"HELLO\".downcase", "\"Code\".downcase", "\"A1\".downcase"]
40
+ examples: [
41
+ "\"HELLO\".downcase",
42
+ "\"Code\".downcase",
43
+ "\"A1\".downcase"
44
+ ]
44
45
  },
45
46
  "lower_case" => {
46
47
  name: "lower_case",
@@ -122,7 +123,8 @@ class Code
122
123
  },
123
124
  "capitalize" => {
124
125
  name: "capitalize",
125
- description: "returns the string with its first character capitalized.",
126
+ description:
127
+ "returns the string with its first character capitalized.",
126
128
  examples: [
127
129
  "\"hello\".capitalize",
128
130
  "\"code\".capitalize",
@@ -132,7 +134,11 @@ class Code
132
134
  "characters" => {
133
135
  name: "characters",
134
136
  description: "returns the string characters as a list.",
135
- examples: ["\"abc\".characters", "\"hi\".characters", "\"\".characters"]
137
+ examples: [
138
+ "\"abc\".characters",
139
+ "\"hi\".characters",
140
+ "\"\".characters"
141
+ ]
136
142
  },
137
143
  "bytes" => {
138
144
  name: "bytes",
@@ -156,7 +162,11 @@ class Code
156
162
  "codepoints" => {
157
163
  name: "codepoints",
158
164
  description: "returns the string codepoints as a list.",
159
- examples: ["\"abc\".codepoints", "\"A\".codepoints", "\"\".codepoints"]
165
+ examples: [
166
+ "\"abc\".codepoints",
167
+ "\"A\".codepoints",
168
+ "\"\".codepoints"
169
+ ]
160
170
  },
161
171
  "character_code_at" => {
162
172
  name: "character_code_at",
@@ -174,7 +184,8 @@ class Code
174
184
  },
175
185
  "chomp" => {
176
186
  name: "chomp",
177
- description: "returns the string with a trailing record separator removed.",
187
+ description:
188
+ "returns the string with a trailing record separator removed.",
178
189
  examples: ["\"a\\n\".chomp", "\"a\".chomp", "\"a\\r\\n\".chomp"]
179
190
  },
180
191
  "chop" => {
@@ -295,7 +306,8 @@ class Code
295
306
  },
296
307
  "parameterize" => {
297
308
  name: "parameterize",
298
- description: "returns the string parameterized for identifiers or urls.",
309
+ description:
310
+ "returns the string parameterized for identifiers or urls.",
299
311
  examples: [
300
312
  "\"Hello world\".parameterize",
301
313
  "\"a b c\".parameterize",
@@ -304,7 +316,8 @@ class Code
304
316
  },
305
317
  "squish" => {
306
318
  name: "squish",
307
- description: "returns the string with surrounding and repeated whitespace collapsed.",
319
+ description:
320
+ "returns the string with surrounding and repeated whitespace collapsed.",
308
321
  examples: [
309
322
  "\" hello world \".squish",
310
323
  "\"a\\n b\".squish",
@@ -377,7 +390,11 @@ class Code
377
390
  "swapcase" => {
378
391
  name: "swapcase",
379
392
  description: "returns the string with letter case swapped.",
380
- examples: ["\"AbC\".swapcase", "\"hello\".swapcase", "\"ABC\".swapcase"]
393
+ examples: [
394
+ "\"AbC\".swapcase",
395
+ "\"hello\".swapcase",
396
+ "\"ABC\".swapcase"
397
+ ]
381
398
  },
382
399
  "titleize" => {
383
400
  name: "titleize",
@@ -414,13 +431,18 @@ class Code
414
431
  },
415
432
  "strip" => {
416
433
  name: "strip",
417
- description: "returns the string with surrounding whitespace removed.",
434
+ description:
435
+ "returns the string with surrounding whitespace removed.",
418
436
  examples: ["\" a \".strip", "\"\\na\".strip", "\"a\".strip"]
419
437
  },
420
438
  "left_strip" => {
421
439
  name: "left_strip",
422
440
  description: "returns the string with leading whitespace removed.",
423
- examples: ["\" a\".left_strip", "\"\\na\".left_strip", "\"a\".left_strip"]
441
+ examples: [
442
+ "\" a\".left_strip",
443
+ "\"\\na\".left_strip",
444
+ "\"a\".left_strip"
445
+ ]
424
446
  },
425
447
  "right_strip" => {
426
448
  name: "right_strip",
@@ -434,7 +456,11 @@ class Code
434
456
  "slice" => {
435
457
  name: "slice",
436
458
  description: "returns a slice from the string.",
437
- examples: ["\"abc\".slice(0)", "\"abc\".slice(0, 2)", "\"abc\".slice(1)"]
459
+ examples: [
460
+ "\"abc\".slice(0)",
461
+ "\"abc\".slice(0, 2)",
462
+ "\"abc\".slice(1)"
463
+ ]
438
464
  },
439
465
  "left_justify" => {
440
466
  name: "left_justify",
@@ -507,11 +533,7 @@ class Code
507
533
  "words" => {
508
534
  name: "words",
509
535
  description: "returns the words in the string as a list.",
510
- examples: [
511
- "\"hello world\".words",
512
- "\"one two\".words",
513
- "\"\".words"
514
- ]
536
+ examples: ["\"hello world\".words", "\"one two\".words", "\"\".words"]
515
537
  }
516
538
  }.freeze
517
539
 
@@ -932,12 +954,13 @@ class Code
932
954
  [
933
955
  {
934
956
  left_operation: {
935
- first: { call: { name: "_" } },
936
- others: [
937
- {
938
- operator: ".",
939
- statement: { call: { name: raw } }
957
+ first: {
958
+ call: {
959
+ name: "_"
940
960
  }
961
+ },
962
+ others: [
963
+ { operator: ".", statement: { call: { name: raw } } }
941
964
  ]
942
965
  }
943
966
  }
@@ -1095,7 +1118,8 @@ class Code
1095
1118
  finish_index = code_finish.nothing? ? raw.length : code_finish.raw
1096
1119
  start_index = 0 if start_index.negative?
1097
1120
  finish_index = 0 if finish_index.negative?
1098
- start_index, finish_index = finish_index, start_index if start_index > finish_index
1121
+ start_index, finish_index = finish_index, start_index if start_index >
1122
+ finish_index
1099
1123
 
1100
1124
  String.new(raw[start_index...finish_index].to_s)
1101
1125
  end
@@ -5,7 +5,8 @@ class Code
5
5
  class Super < Function
6
6
  CLASS_DOCUMENTATION = {
7
7
  name: "Super",
8
- description: "calls the captured parent function available inside an extended function.",
8
+ description:
9
+ "calls the captured parent function available inside an extended function.",
9
10
  examples: [
10
11
  "Base = () => { self.name = :base self } Child = Base.extend(() => { super() }) Child().name",
11
12
  "Base = (name) => { self.name = name self } Child = Base.extend((...) => { super(...) }) Child(:ada).name",