Sha256: 7f21e2f762857f7df2da791688ee773fb91767e093e8d5752d4fb3475a43b8df
Contents?: true
Size: 677 Bytes
Versions: 1
Compression:
Stored size: 677 Bytes
Contents
require_relative "input" require "tty-prompt" class VagrantWizard::Select < VagrantWizard::Input def processInput prompt = TTY::Prompt.new choices = Hash.new @data['choices'].each do |choice| choices[choice['name']] = choice['value'] end if @data.key?('default') default_index = choices.find_index do |key,value| value == @data['default'] end default_index += 1 @output = prompt.select(@prompt) do |menu| menu.default default_index choices.each do |key,value| menu.choice key,value end end return end @output = prompt.select(@prompt, choices) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vagrant-wizard-0.3.0 | lib/vagrant-wizard/inputs/select.rb |