I have a module called Sms
that I'm defining in lib/sms.rb
. Within it, I have a method called Sms.chunk
that uses the method word_wrap
. This is part of the TextHelper library, so I am including it at the beginning of the module with include ActionView::Helpers::TextHelper
:
module Sms
include ActionView::Helpers::TextHelper
def Sms.chunk
...
word_wrap
...
I am requiring this module during initialization with the line require "sms"
in config/initializers/additional_libs.rb
I also have a Grape API class called TWILIO_API where I want to call Sms.chunk
. However, when I do, I get undefined method
word_wrap' for Sms:Module`. I have tried including the TextHelper library in the TWILIO_API class itself, and various other ways of including it, but have had no success.
What am I doing wrong here?