Sha256: 9d1a3153c347c3c967738f000b52ff5ce412759654ef28cdffb28077598a8275
Contents?: true
Size: 691 Bytes
Versions: 1
Compression:
Stored size: 691 Bytes
Contents
module LovelyRufus class QuoteStripper < Layer def call wrap @wrap = wrap wrapped = next_layer.call stripped_wrap quoted = wrapped.text.lines.map { |line| fixed_quote + line }.join Wrap[quoted, width: wrapped.width + fixed_quote.size] end attr_reader :wrap private :wrap private def fixed_quote quote.size > 0 ? quote.delete(' ') + ' ' : '' end def quote starts = wrap.text.lines.map { |line| line[QUOTES] }.uniq starts.size == 1 ? starts.first || '' : '' end def stripped_wrap stripped_text = wrap.text.lines.map { |line| line[quote.size..-1] }.join Wrap[stripped_text, width: wrap.width - fixed_quote.size] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lovely_rufus-0.1.2 | lib/lovely_rufus/quote_stripper.rb |