Class: Downup::Base
- Inherits:
-
Object
- Object
- Downup::Base
- Defined in:
- lib/downup.rb
Instance Method Summary collapse
-
#initialize(options:, title: nil, default_color: :brown, selected_color: :magenta, selector: "‣", stdin: $stdin, stdout: $stdout, header_proc: Proc.new {}) ⇒ Base
constructor
A new instance of Base.
- #prompt(position = 0) ⇒ Object
Constructor Details
#initialize(options:, title: nil, default_color: :brown, selected_color: :magenta, selector: "‣", stdin: $stdin, stdout: $stdout, header_proc: Proc.new {}) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/downup.rb', line 10 def initialize(options:, title: nil, default_color: :brown, selected_color: :magenta, selector: "‣", stdin: $stdin, stdout: $stdout, header_proc: Proc.new {}) @options = @title = title @default_color = default_color @selected_color = selected_color @selector = selector @header_proc = header_proc @stdin = stdin @stdout = stdout @colonel = Kernel end |
Instance Method Details
#prompt(position = 0) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/downup.rb', line 30 def prompt(position = 0) @selected_position = position_selector(position) colonel.system("clear") header_proc.call print_title Downup::OptionsPrinter.new( options: , selected_position: @selected_position, default_color: default_color, selected_color: selected_color, selector: selector ). stdout.print "\n> " input = read_char process_input input end |