Allow `ask' action to customize choices prompt

This commit is contained in:
Thibault Jouan
2014-01-21 01:19:17 +00:00
parent 7e062e06a1
commit 0d0ed541c8
4 changed files with 8 additions and 8 deletions

View File

@@ -10,11 +10,11 @@ module Producer
def prompt(question, choices)
cs = choices.each_with_index.inject('') do |m, (c, i)|
m += "#{i}: #{c}\n"
m += "#{i}: #{c.last}\n"
end
output.puts "#{question}\n#{cs}Choice:"
choice = input.gets
choices[choice.to_i]
choices[choice.to_i].first
end
end
end