Method: HighLine::ListRenderer#initialize
- Defined in:
- lib/highline/list_renderer.rb
#initialize(items, mode = :rows, option = nil, highline) ⇒ ListRenderer
The only required parameters are items and highline. Recognized modes are:
:columns_across-
items will be placed in columns, flowing from left to right. If given, option is the number of columns to be used. When absent, columns will be determined based on wrap_at or a default of 80 characters.
:columns_down-
Identical to
:columns_across, save flow goes down. :uneven_columns_across-
Like
:columns_acrossbut each column is sized independently. :uneven_columns_down-
Like
:columns_downbut each column is sized independently. :inline-
All items are placed on a single line. The last two items are separated by option or a default of “ or ”. All other items are separated by “, ”.
:rows-
The default mode. Each of the items is placed on its own line. The option parameter is ignored in this mode.
Each member of the items Array is passed through ERb and thus can contain their own expansions. Color escape expansions do not contribute to the final field width.
62 63 64 65 66 67 |
# File 'lib/highline/list_renderer.rb', line 62 def initialize(items, mode = :rows, option = nil, highline) @highline = highline @mode = mode @option = option @items = render_list_items(items) end |