I have a ruby script that’s doing what I need, and I would like to add
one feature. The script outputs a text file, and I would like Ruby to
take the final text file and wrap it at 67 characters, instead of doing
it manually in the editor.
Is there an available method or something that I can invoke? If so, can
you give me an example of its use (I’m still very much a novice!)
X = 10 # Width is 10 characters.
str =
“This\nis a test of the emergency broadcasting servicings I
asseverate”
p str.gsub(/\n/," ").scan(/\S.{0,#{X-2}}\S(?=\s|$)|\S+/)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.