Sha256: 8004df746165b64347ed23789b9711dfd95229762cc5a02f6eecef9897d97501
Contents?: true
Size: 651 Bytes
Versions: 1
Compression:
Stored size: 651 Bytes
Contents
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.2.0 | lib/vagrant-wizard/inputs/select.rb |