class SemanticLinefeeds::Converter

Constants

SPLIT_AFTER
SPLIT_BEFORE

Public Class Methods

run(text) click to toggle source
# File lib/semantic_linefeeds/converter.rb, line 25
def self.run(text)
  SPLIT_BEFORE.each do |splitter|
    text = text.split(" #{splitter}").join("\n#{splitter}")
  end

  SPLIT_AFTER.each do |splitter|
    text = text.split("#{splitter} ").join("#{splitter}\n")
  end

  text
end