class Shoulda::Matchers::Document
@private
Attributes
Public Class Methods
Source
# File lib/shoulda/matchers/util/word_wrap.rb, line 16 def initialize(document, indent: 0) @document = document @indent = indent end
Public Instance Methods
Source
# File lib/shoulda/matchers/util/word_wrap.rb, line 21 def wrap wrapped_paragraphs.map { |lines| lines.join("\n") }.join("\n\n") end
Private Instance Methods
Source
# File lib/shoulda/matchers/util/word_wrap.rb, line 31 def paragraphs document.split(/\n{2,}/) end
Source
# File lib/shoulda/matchers/util/word_wrap.rb, line 35 def wrapped_paragraphs paragraphs.map do |paragraph| Paragraph.new(paragraph, indent: indent).wrap end end