'("\\bdef[ \t]+[a-zA-Z_]+[a-zA-Z0-9_]*[?!]?"
        0 font-lock-function-name-face))
     "*Additional expressions to highlight in ruby mode.")
 (add-hook 'ruby-mode-hook
          (lambda ()
            (setq font-lock-keywords ruby-font-lock-keywords)
            (font-lock-mode 1)))))
 (if (and (>= (string-to-int emacs-version) 20)
         (not (featurep 'xemacs)))
     (add-hook
      'ruby-mode-hook
      (lambda ()
       (make-local-variable 'font-lock-defaults)
       (setq font-lock-defaults 
             '((ruby-font-lock-keywords) nil nil ((?\_ . "w"))))))
   (add-hook 'ruby-mode-hook
            (lambda ()
              (setq font-lock-keywords ruby-font-lock-keywords)
              (font-lock-mode 1))))))

Nasser Alhawash