Class: Rorr::TestPass
Instance Attribute Summary collapse
-
#index ⇒ Object
Returns the value of attribute index.
-
#questions ⇒ Object
Returns the value of attribute questions.
Instance Method Summary collapse
-
#initialize ⇒ TestPass
constructor
A new instance of TestPass.
- #start ⇒ Object
Methods included from Base
#generate_file_base_path, #read_template, #templates_path
Constructor Details
#initialize ⇒ TestPass
Returns a new instance of TestPass.
6 7 8 9 |
# File 'lib/rorr/test_pass.rb', line 6 def initialize @questions = [] create_questions end |
Instance Attribute Details
#index ⇒ Object
Returns the value of attribute index.
4 5 6 |
# File 'lib/rorr/test_pass.rb', line 4 def index @index end |
#questions ⇒ Object
Returns the value of attribute questions.
4 5 6 |
# File 'lib/rorr/test_pass.rb', line 4 def questions @questions end |
Instance Method Details
#start ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rorr/test_pass.rb', line 11 def start system 'clear' UI.puts "\nWelcome to #{'"Make all tests pass"'.light_cyan}" UI.puts "Let's check how much do you proficiency in ruby or rails\n" Score.start @questions.each.with_index(1) do |question, index| UI.sleep_with_setting self.index = index - 1 Score.init(index) generate_file(index) while answer = UI.gets case answer.downcase when 'rorr' if check_answer(index) Score.add_correct break end UI.sleep_with_setting UI.puts "\nPlease Try Again. Make all tests pass." UI.puts "Type #{'rorr'.green} to check, #{UI.skip}, #{UI.exit}" Score.add_retry when 'skip' UI.puts 'Skip the Question!'.light_blue Score.add_skip break when 'exit' then exit else UI.puts_with_delay 'Please enter again!'.light_blue end end Score.add_report UI.solution(question[:sol]) end Score.finish Score.export_report UI.report end |