Class: Text::Reform::BreakWrap

Inherits:
Object
  • Object
show all
Defined in:
lib/text/reform.rb

Instance Method Summary collapse

Constructor Details

#initializeBreakWrap

Returns a new instance of BreakWrap.



1502
1503
# File 'lib/text/reform.rb', line 1502

def initialize
end

Instance Method Details

#break(text, initial, total) ⇒ Object

Break by wrapping and slopping to the next line.

initial_max_length

The maximum size of the first part of the word that will remain on the first line.

total_width

The total width that can be appended to this first line.



1511
1512
1513
1514
1515
1516
1517
1518
# File 'lib/text/reform.rb', line 1511

def break(text, initial, total)
  if initial == total
    text =~ /\A(\s*\S*)(.*)/
      return $1, $2
  else
    return '', text
  end
end