code-ruby 2.0.2 → 3.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/VERSION +1 -1
- data/lib/code/format.rb +4 -2
- data/lib/code/parser.rb +1113 -6
- data/lib/code-ruby.rb +0 -1
- data/spec/code/node/call_spec.rb +1 -1
- data/spec/code/parser/boolean_spec.rb +1 -1
- data/spec/code/parser/chained_call_spec.rb +1 -1
- data/spec/code/parser/dictionary_spec.rb +1 -1
- data/spec/code/parser/function_spec.rb +1 -1
- data/spec/code/parser/group_spec.rb +1 -1
- data/spec/code/parser/if_modifier_spec.rb +1 -1
- data/spec/code/parser/list_spec.rb +1 -1
- data/spec/code/parser/number_spec.rb +1 -1
- data/spec/code/parser/string_spec.rb +1 -1
- data/spec/code_spec.rb +1 -1
- metadata +1 -42
- data/lib/code/parser/addition.rb +0 -23
- data/lib/code/parser/and_operator.rb +0 -19
- data/lib/code/parser/bitwise_and.rb +0 -23
- data/lib/code/parser/bitwise_or.rb +0 -23
- data/lib/code/parser/boolean.rb +0 -23
- data/lib/code/parser/call.rb +0 -165
- data/lib/code/parser/chained_call.rb +0 -31
- data/lib/code/parser/class.rb +0 -15
- data/lib/code/parser/code.rb +0 -27
- data/lib/code/parser/dictionary.rb +0 -76
- data/lib/code/parser/equal.rb +0 -67
- data/lib/code/parser/equality.rb +0 -42
- data/lib/code/parser/function.rb +0 -135
- data/lib/code/parser/greater.rb +0 -32
- data/lib/code/parser/group.rb +0 -58
- data/lib/code/parser/if.rb +0 -101
- data/lib/code/parser/if_modifier.rb +0 -39
- data/lib/code/parser/label_name.rb +0 -14
- data/lib/code/parser/left_operation.rb +0 -44
- data/lib/code/parser/list.rb +0 -47
- data/lib/code/parser/multiplication.rb +0 -39
- data/lib/code/parser/name.rb +0 -188
- data/lib/code/parser/negation.rb +0 -32
- data/lib/code/parser/not_keyword.rb +0 -29
- data/lib/code/parser/nothing.rb +0 -19
- data/lib/code/parser/number.rb +0 -156
- data/lib/code/parser/or_keyword.rb +0 -27
- data/lib/code/parser/or_operator.rb +0 -19
- data/lib/code/parser/power.rb +0 -19
- data/lib/code/parser/range.rb +0 -19
- data/lib/code/parser/rescue.rb +0 -19
- data/lib/code/parser/right_operation.rb +0 -44
- data/lib/code/parser/shift.rb +0 -23
- data/lib/code/parser/splat.rb +0 -33
- data/lib/code/parser/square_bracket.rb +0 -44
- data/lib/code/parser/statement.rb +0 -11
- data/lib/code/parser/string.rb +0 -85
- data/lib/code/parser/ternary.rb +0 -45
- data/lib/code/parser/unary_minus.rb +0 -33
- data/lib/code/parser/while.rb +0 -81
- data/lib/code/parser/whitespace.rb +0 -51
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c4aec10b766ce32c39c533055ec8a17e8463551a11e83c995028dbf43b67d42e
|
|
4
|
+
data.tar.gz: 8f88527a8964da7c61fef7990f29582c56c542d59d33e11700c2ea0801be6749
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: da6c39843bfc479cfd66f965f9eacb6c80b002beda34c30128f2e5db4ac7bc787b0c002406385089ebeb3fd640896005cb2f54ba4e87c232600ed7275a7b43f6
|
|
7
|
+
data.tar.gz: 457cba3cadc88d3a4a1520ec4b7dfbdb0c2088e16be3b6097be26d9cf6aab4f83cc33ad178baaea42895143c0867bc3e70dc9424e60f0dfeb8f807c72c5d7ff1
|
data/Gemfile.lock
CHANGED
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
3.0.0
|
data/lib/code/format.rb
CHANGED
|
@@ -279,7 +279,7 @@ class Code
|
|
|
279
279
|
end
|
|
280
280
|
|
|
281
281
|
def format_dictionary(key_values, indent:)
|
|
282
|
-
return "{}" if key_values == "" || key_values.nil?
|
|
282
|
+
return "{}" if key_values == "" || key_values.nil? || key_values == []
|
|
283
283
|
|
|
284
284
|
values =
|
|
285
285
|
Array(key_values).map do |key_value|
|
|
@@ -321,8 +321,10 @@ class Code
|
|
|
321
321
|
raw_arguments = call[:arguments].presence || []
|
|
322
322
|
arguments = raw_arguments.map { |arg| format_call_argument(arg) }
|
|
323
323
|
statement =
|
|
324
|
-
if arguments.empty?
|
|
324
|
+
if arguments.empty? && !call.key?(:arguments)
|
|
325
325
|
name.to_s
|
|
326
|
+
elsif arguments.empty?
|
|
327
|
+
"#{name}()"
|
|
326
328
|
elsif multiline_call_arguments?(raw_arguments, arguments)
|
|
327
329
|
body = arguments.map { |arg| indent_lines(arg, indent + 1) }.join(",\n")
|
|
328
330
|
"#{name}(\n#{body}\n#{INDENT * indent})"
|