Class: Idcf::Cli::Lib::Util::Input
- Inherits:
-
Object
- Object
- Idcf::Cli::Lib::Util::Input
- Defined in:
- lib/idcf/cli/lib/util/input.rb
Overview
input
Class Method Summary collapse
-
.qa(title, setting, nd = '') ⇒ String
qa.
-
.qa_answer_input(list, nd = '') ⇒ String
qa_answer_input.
Class Method Details
.qa(title, setting, nd = '') ⇒ String
qa
14 15 16 17 18 19 20 21 |
# File 'lib/idcf/cli/lib/util/input.rb', line 14 def qa(title, setting, nd = '') loop do v = qa_setting_list(setting) qa_puts_question(title, nd, v) result = qa_answer_input(v, nd) return result unless result.empty? end end |
.qa_answer_input(list, nd = '') ⇒ String
qa_answer_input
28 29 30 31 32 33 34 35 36 |
# File 'lib/idcf/cli/lib/util/input.rb', line 28 def qa_answer_input(list, nd = '') loop do res = STDIN.gets.strip result = res.empty? ? nd : res return result if qa_answer?(result, list) puts "from this [#{list.join('/')}]" '' end end |