Hi Ruby Community,

I just fiddled around with the ruby-imenu-create-index defun in
ruby-mode.el and I think I found a way to solve this problem:

Put the following after the save-restriction and before the second
condition (string= "def" decl):

(goto-char (region-end))

So that the whole area looks like:

  (save-restriction
    (narrow-to-region (region-beginning) (region-end))
    (while (re-search-forward "^\\s *def\\s *\\([^(\n ]+\\)" nil t)
         (setq method-begin (match-beginning 1))
         (setq method-name (buffer-substring method-begin (match-end
1)))
         (push (cons (concat class-name "#" method-name)
(match-beginning 0)) index-alist)))
    (goto-char (region-end)))
((string= "def" decl)

I hope this helps (despite the fact that I did not really provide a
patch) and that it works for others, too

Regards
Stefan Kamphausen