Skip to content

Commit 8206963

Browse files
v3.0.0
1 parent 1a24b69 commit 8206963

57 files changed

Lines changed: 1130 additions & 2042 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
code-ruby (2.0.2)
4+
code-ruby (3.0.0)
55
activesupport
66
base64
77
bigdecimal

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.0.2
1+
3.0.0

lib/code-ruby.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
require "did_you_mean"
99
require "digest"
1010
require "json"
11-
require "language-ruby"
1211
require "mail"
1312
require "net/http"
1413
require "nokogiri"

lib/code/format.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ def format_list(elements, indent:)
279279
end
280280

281281
def format_dictionary(key_values, indent:)
282-
return "{}" if key_values == "" || key_values.nil?
282+
return "{}" if key_values == "" || key_values.nil? || key_values == []
283283

284284
values =
285285
Array(key_values).map do |key_value|
@@ -321,8 +321,10 @@ def format_call(call, indent:)
321321
raw_arguments = call[:arguments].presence || []
322322
arguments = raw_arguments.map { |arg| format_call_argument(arg) }
323323
statement =
324-
if arguments.empty?
324+
if arguments.empty? && !call.key?(:arguments)
325325
name.to_s
326+
elsif arguments.empty?
327+
"#{name}()"
326328
elsif multiline_call_arguments?(raw_arguments, arguments)
327329
body = arguments.map { |arg| indent_lines(arg, indent + 1) }.join(",\n")
328330
"#{name}(\n#{body}\n#{INDENT * indent})"

0 commit comments

Comments
 (0)