module Gemmy::Patches::StringPatch::InstanceMethods::LineWrap
Public Instance Methods
line_wrap(width, tabs=4)
click to toggle source
facets wrap lines at width
# File lib/gemmy/patches/string_patch.rb, line 157 def line_wrap(width, tabs=4) s = gsub(/\t/,' ' * tabs) # tabs default to 4 spaces s = s.gsub(/\n/,' ') r = s.scan( /.{1,#{width}}/ ) r.join("\n") << "\n" end