Method: WordWrapper#line_cost
- Defined in:
- lib/word_wrapper.rb
#line_cost(line) ⇒ Object
Calculate the cost of a line. Cost is defined as
[ Trailing whitespace ] ^ 2
26 27 28 |
# File 'lib/word_wrapper.rb', line 26 def line_cost(line) (@width - line.strip.length)**2 # no lines will ever start with whitespace end |