Class: HighlineWrapper::CheckboxQuestion

Inherits:
Question
  • Object
show all
Defined in:
lib/highline_wrapper/checkbox_question.rb

Class Method Summary collapse

Methods inherited from Question

ask_highline, format_options, format_selection, recurse, return_empty_defaults

Class Method Details

.ask(prompt, choices, options) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/highline_wrapper/checkbox_question.rb', line 8

def ask(prompt, choices, options)
  indices = ask_highline(format_options(prompt, choices))

  return format_multiple_selections(choices, indices, options[:with_indexes]) unless indices.empty?
  return recurse(prompt, choices, options) if options[:required]
  return return_empty_defaults(options) if options[:defaults].empty?

  return_defaults(choices, options)
end