Module: ConsoleKit::TenantSelector

Defined in:
lib/console_kit/tenant_selector.rb

Overview

For tenant selection

Class Method Summary collapse

Class Method Details

.select(tenants, keys) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/console_kit/tenant_selector.rb', line 9

def select(tenants, keys)
  print_tenant_selection_menu(tenants, keys)

  3.times do |attempt|
    index = prompt_user_for_selection(keys.size)
    return nil if index.zero?
    return keys[index - 1] if index.positive?

    print_tenant_selection_menu(tenants, keys) if attempt < 2
  end

  nil
end