You could use foldmethod=marker
and add {{{
/ }}}
markers (or other markers of your choosing) to indicate where folds begin and end.
You could also modify the file which defines ruby syntax highlighting to adjust what it considers as eligible for folding with foldmethod=syntax
.
A third option would be to develop a more complex routine for use with foldmethod=expr
. For example, I use the vim functions defined here to define how ruby code should be folded. It automatically defines folds for modules, classes and methods along with any comment lines that immediately precede those; and it supports the standard fold markers for folding other sections. It gets used with foldexpr=ruby#MethodFold(v:lnum)
.
Further information on how fold expressions should behave can be found by doing :help fold-expr
. There's also a nice vimcast about that.