You could include the TextHelper module in your model class to get
access to the methods, but my solution was to extend the String class so
that I could call some of the TextHelpers directly on a string:
If you look at the wrapper methods I’m constructing you’ll notice that I
just copied the default arguments from the TextHelper method definition
to the wrapper definitions. For example:
def highlight(phrase, highlighter = ‘\1’)
TextHelperSingleton.instance.highlight(self, phrase, highlighter)
end
This seems ugly, though, because I’d like not to have to copy the
defaults (DRY) in case they happen to change in TextHelper’s definition.
I tried making my argument defaults nil, but that doesn’t appear to
work.