Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/rufo/formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2147,10 +2147,11 @@ def visit_params(node)
# [:@label, "b:", [1, 20]]
write label[1]
next_token
skip_space_or_newline
if value
consume_space
visit value
else
skip_space
end
end
needs_comma = true
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#~# ORIGINAL issue_331
#~# parens_in_def: :dynamic
class User
def self.by_uid uid:
joins(:authentications).where(authentications: { uid: }).first
end
end

#~# EXPECTED
class User
def self.by_uid uid:
joins(:authentications).where(authentications: { uid: }).first
end
end
10 changes: 10 additions & 0 deletions spec/lib/rufo/formatter_source_specs/method_definition.rb.spec
Original file line number Diff line number Diff line change
Expand Up @@ -371,3 +371,13 @@ end
def foo(a, ...)
p(...)
end

#~# ORIGINAL issue_331
def foo a:
a
end

#~# EXPECTED
def foo(a:)
a
end
Loading