Class: PrettyPrint

Inherits:
Object
  • Object
show all
Defined in:
lib/pretty-printing.rb

Instance Method Summary collapse

Constructor Details

#initialize(quote, length) ⇒ PrettyPrint

Returns a new instance of PrettyPrint.



2
3
4
5
6
# File 'lib/pretty-printing.rb', line 2

def initialize(quote,length)
  @quote = quote
  @length = length
  @arr = @quote.split(" ")
end

Instance Method Details

#formatObject



8
9
10
11
12
13
14
15
16
# File 'lib/pretty-printing.rb', line 8

def format
  q = []
  i = 0
  while i < @arr.length
    q << "  |  #{@arr[i..i+@length].join(" ")}"
    i += @length+1
  end
  @quote = q.join("\n")
end