Method: HighLine::List#initialize

Defined in:
lib/highline/list.rb

#initialize(items, options = {}) ⇒ List

Returns a new instance of List.

Parameters:

  • items (#to_a)

    an array of items to compose the list.

  • options (Hash) (defaults to: {})

    a hash of options to tailor the list.

Options Hash (options):

  • :transpose (Boolean) — default: false
  • :col_down (Boolean) — default: false
  • :cols (Integer) — default: 1

    set #cols.



61
62
63
64
65
66
67
# File 'lib/highline/list.rb', line 61

def initialize(items, options = {})
  @items          = items.to_a.dup.freeze
  @transpose_mode = options.fetch(:transpose) { false }
  @col_down_mode  = options.fetch(:col_down)  { false }
  @cols           = options.fetch(:cols)      { 1 }
  build
end