Method: Net::Text::Reflow.format_body

Defined in:
lib/net/text/reflow.rb

.format_body(body, length) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/net/text/reflow.rb', line 39

def self.format_body(body, length)
  new_body = []
  mono_block_open = false
  body.each_line do |line|
    if line.start_with?('```')
      mono_block_open = !mono_block_open
      # Don't include code block toggle lines
      next
    end
    new_body += reflow_text_line(line, mono_block_open, length)
  end
  new_body.join("\n")
end