Class: LovelyRufus::Layers::BasicWrapper
- Defined in:
- lib/lovely_rufus/layers/basic_wrapper.rb
Instance Method Summary collapse
Methods inherited from Layer
Constructor Details
This class inherits a constructor from LovelyRufus::Layers::Layer
Instance Method Details
#call(wrap) ⇒ Object
7 8 9 10 11 |
# File 'lib/lovely_rufus/layers/basic_wrapper.rb', line 7 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 |