This is actually not so difficult. You can simply enable the module TextHelperfrom your class.
class MyLib
include ActionView::Helpers::TextHelper
def five_things(x)
pluralize 5, x
end
end
>> MyLib.new.five_things "dog"
=> "5 dogs"
This is from class I defined in lib, and the output from the session script/consoleto make sure that all is well.
source
share