ruby-mode: Support endless singleton method definitions too

* lisp/progmodes/ruby-mode.el (ruby-endless-method-head-re):
Update to match not only 'self.' but 'xyz.' as well (bug#54702).

* test/lisp/progmodes/ruby-mode-resources/ruby.rb (Bar#foo=):
Update example.
This commit is contained in:
Dmitry Gutov 2022-12-19 02:21:51 +02:00
parent ce7b7e5af3
commit 9a751e0a38
2 changed files with 5 additions and 2 deletions

View file

@ -135,7 +135,8 @@ This should only be called after matching against `ruby-here-doc-beg-re'."
"Regexp to match symbols.")
(defconst ruby-endless-method-head-re
(format " *\\(self\\.\\)?%s+[?!]? *\\(([^()]*)\\)? +=" ruby-symbol-re)
(format " *\\(%s+\\.\\)?%s+[?!]? *\\(([^()]*)\\)? +="
ruby-symbol-re ruby-symbol-re)
"Regexp to match the beginning of an endless method definition.
It should match the part after \"def\" and until \"=\".")

View file

@ -533,6 +533,8 @@ def foo=(
baz,
bar
)
hello
def baz.full_name = "#{bar} 3"
baz
end
end