class CLI::UI::Prompt::OptionsHandler
A class that handles the various options of an InteractivePrompt and their callbacks
Public Class Methods
new()
click to toggle source
# File lib/cli/ui/prompt/options_handler.rb, line 6 def initialize @options = {} end
Public Instance Methods
call(options)
click to toggle source
# File lib/cli/ui/prompt/options_handler.rb, line 18 def call(options) case options when Array options.map { |option| @options[option].call(options) } else @options[options].call(options) end end
option(option, &handler)
click to toggle source
# File lib/cli/ui/prompt/options_handler.rb, line 14 def option(option, &handler) @options[option] = handler end
options()
click to toggle source
# File lib/cli/ui/prompt/options_handler.rb, line 10 def options @options.keys end