Class: SemanticLinefeeds::Converter
- Inherits:
-
Object
- Object
- SemanticLinefeeds::Converter
- Defined in:
- lib/semantic_linefeeds/converter.rb
Constant Summary collapse
- SPLIT_AFTER =
%w[ , . ... … ? : ; ! ) \] ].freeze
- SPLIT_BEFORE =
%w[ ( \[ http ].freeze
Class Method Summary collapse
Class Method Details
.run(text) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/semantic_linefeeds/converter.rb', line 22 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 |