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:, title: nil, default_color: :brown, selected_color: :magenta, selector: "‣", stdin: $stdout, stdout: $stdout, header_proc: Proc.new {}) ⇒ 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
# File 'lib/downup/options_printer.rb', line 7

def initialize(options:,
               selected_position:,
               title: nil,
               default_color: :brown,
               selected_color: :magenta,
               selector: "",
               stdin: $stdout,
               stdout: $stdout,
               header_proc: Proc.new {})

  @options           = options
  @title             = title
  @default_color     = default_color
  @selected_position = selected_position
  @selected_color    = selected_color
  @selector          = selector
  @header_proc       = header_proc
  @stdin             = stdin
  @stdout            = stdout
  @colonel           = Kernel
end

Instance Method Details



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

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