Method: ListFormatter#initialize
- Defined in:
- lib/list_formatter.rb
#initialize(layout = '', a = [], title: 'Untitled List', field_marker: '$', width: 60) ⇒ ListFormatter
Returns a new instance of ListFormatter.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/list_formatter.rb', line 9 def initialize(layout='', a=[], title: 'Untitled List', field_marker: '$', width: 60) top = "== #{title} ".ljust(width,'=') bottom = '=' * width @to_s = top + "\n\n" \ + format_rows(a, layout, field_marker).join("\n" + '-' * width \ + "\n\n") + "\n" + bottom end |