Sha256: 2cf8c63c058cc0978e9404d030b8d72bbaa4c797799c7b10c946ccf2f6fff76c

Contents?: true

Size: 313 Bytes

Versions: 2

Compression:

Stored size: 313 Bytes

Contents

require_relative 'layer'
require_relative 'wrap'

module LovelyRufus
  class BasicWrapper < Layer
    def call(wrap)
      unwrapped = wrap.text.tr("\n", ' ').strip
      wrapped   = unwrapped.gsub(/(.{1,#{wrap.width}})( |$\n?)/, "\\1\n")
      next_layer.call(Wrap[wrapped, width: wrap.width])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lovely_rufus-0.2.1 lib/lovely_rufus/basic_wrapper.rb
lovely_rufus-0.2.0 lib/lovely_rufus/basic_wrapper.rb