The `hideshow' Emacs minor mode lets you hide the content of a block
of code and only see the first line.  This is what I put in my
~/.emacs file to have it work with Ruby:


(defun ruby-custom-setup ()
; [other stuff omitted...]
  (add-to-list 'hs-special-modes-alist
	       '(ruby-mode
		 "\\(def\\|do\\)"
		 "end"
		 "#"
		 (lambda (arg) (ruby-end-of-block))
		 nil
		 ))
  (hs-minor-mode t)
)

(add-hook 'ruby-mode-hook 'ruby-custom-setup)


Then with M-x hs-hide-all...


def hello
  puts "hello world"
end

...becomes:

def hello...


Beware, it'll choke on def's and end's appearing in strings.  I didn't
care of that, my eyes still ache in front of regexps defined in
elisp. %-)


Massimiliano