Module: One44::CLI::Helpers
- Defined in:
- lib/one44-cli/helpers.rb
Instance Method Summary collapse
- #answer ⇒ Object
- #clean(answer) ⇒ Object
- #ordered_questions(test, question_order) ⇒ Object
- #questions_from(test) ⇒ Object
- #randomise(questions) ⇒ Object
Instance Method Details
#answer ⇒ Object
6 7 8 |
# File 'lib/one44-cli/helpers.rb', line 6 def answer gets.chomp end |
#clean(answer) ⇒ Object
10 11 12 13 14 |
# File 'lib/one44-cli/helpers.rb', line 10 def clean(answer) Integer(answer).to_i rescue StandardError nil end |
#ordered_questions(test, question_order) ⇒ Object
16 17 18 |
# File 'lib/one44-cli/helpers.rb', line 16 def ordered_questions(test, question_order) question_order == :random ? randomise(questions_from(test)) : questions_from(test) end |
#questions_from(test) ⇒ Object
24 25 26 |
# File 'lib/one44-cli/helpers.rb', line 24 def questions_from(test) load_tests_from_csv_file(test, "\t\t") end |
#randomise(questions) ⇒ Object
20 21 22 |
# File 'lib/one44-cli/helpers.rb', line 20 def randomise(questions) questions.shuffle end |