Class: Downup::OptionsPrinter

Inherits:
Object
  • Object
show all
Defined in:
lib/downup/options_printer.rb

Instance Method Summary collapse

Constructor Details

#initialize(options:, selected_position: 0, default_color: :brown, selected_color: :magenta, selector: "‣", multi_selected_positions: [], multi_select_selector: "√", type: :default, stdin: $stdout, stdout: $stdout) ⇒ OptionsPrinter

Returns a new instance of OptionsPrinter.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/downup/options_printer.rb', line 7

def initialize(options:,
               selected_position: 0,
               default_color: :brown,
               selected_color: :magenta,
               selector: "",
               multi_selected_positions: [],
               multi_select_selector: "",
               type: :default,
               stdin: $stdout,
               stdout: $stdout)

  @options                  = options
  @default_color            = default_color
  @selected_position        = selected_position
  @selected_color           = selected_color
  @multi_selected_positions = multi_selected_positions
  @multi_select_selector    = multi_select_selector
  @selector                 = selector
  @type                     = type
  @stdin                    = stdin
  @stdout                   = stdout
  @colonel                  = Kernel
end

Instance Method Details



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/downup/options_printer.rb', line 31

def print_options
  case options
  when Array then print_array_options
  when Hash
    if options_has_value_and_display?
      print_complex_hash_options
    else
      print_simple_hash_options
    end
  end
end