I would definitely go with User-Defined styles for the text files.
For Ruby, since it is an already defined language, you can either
- Try to redefine the language as a user-one + add your additional folding items (but it is very painful)
- Use a work-around as explained in https://stackoverflow.com/a/16472818/1603480
But, that would be for a specific language so you would have to select the style for each language (so doesn't meet your requirement "for any language").
Probably a solution would be a macro or a Python script modifying your text (for example by using the hide function of Notepad++).