Method: WordWrapper#total_cost

Defined in:
lib/word_wrapper.rb

#total_cost(text) ⇒ Object

The total cost of a block of text

Parameters:

  • text (String)


32
33
34
# File 'lib/word_wrapper.rb', line 32

def total_cost(text)
  text.split("\n").inject(0){ |acc, line| acc + line_cost(line) }
end