sun_quiz 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d6c7a9482acb90b4c21a63ebdeb9ddff1f87eb334f691d52b2bdb2757d7fb31
4
- data.tar.gz: be8a7bd0645fdaddc254657fe255ad300edc8cb46aa8117c580012a515e65f4e
3
+ metadata.gz: 8346abdfccdd73863dbdb83de65cc5eaa48cde14f47f7425d26b6c08cd0d3ec0
4
+ data.tar.gz: 178c83095981d8a3a7d7335d3595c3c4910d41883bd480dcbe932f56255059fa
5
5
  SHA512:
6
- metadata.gz: 101f2feeae29c1d695329e446d4efedfec094f04f3df4a85c28b74a2d0c33286b20640bcfe9303cb6dc2d33db528dfc19bebea34ba474a20bde3879fa8f7ce59
7
- data.tar.gz: 66e5f4f959ab7cb895a6193d3f51c5de30065b6383054a3b79840bdcda6e1794a291f5ce4678a906b915e9b21ed2d7c690a8082622809223f6150d5d5732ed16
6
+ metadata.gz: 71b4a8dd3645050788894429c89bf8649ec1d0dd9be60c1d85ce3596a7d541268f2d2f55e681a7ec10b4208679c45b5060beeae4f47ba27e82078dcc0b3dcd36
7
+ data.tar.gz: c96b85bb152c0116755a6c1c8b0e178bcc75fe6f8109fc6770a56718e76a8fa70d66d69a12c76f7d23d86ad01c45e23082e76432eacaa99b681816b28223f297
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sun_quiz (0.1.0)
4
+ sun_quiz (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -1,36 +1,26 @@
1
1
  require "sun_quiz/version"
2
2
 
3
3
  module SunQuiz
4
- class Error < StandardError; end
5
4
  class Question
6
5
  attr_accessor :prompt, :answer
7
6
  def initialize prompt, answer
8
7
  @prompt = prompt
9
8
  @answer = answer
10
9
  end
11
-
12
- def self.run_quiz
13
- p1 = "What color are apples?\n(a) Red/Green\n(b)Orange"
14
- p2 = "What color are bananas?\n(a) Red/Green\n(b)Yellow"
15
-
16
- questions = [
17
- Question.new(p1, "a"),
18
- Question.new(p2, "b")
19
- ]
20
- new.run_quiz questions
21
- end
22
10
  end
23
-
24
- def run_quiz questions
25
- answer = ""
26
- score = 0
27
- for question in questions
28
- puts question.prompt
29
- answer = gets.chomp()
30
- if answer == question.answer
31
- score += 1
11
+ class Quiz
12
+ def self.import questions
13
+ @questions = questions
14
+ end
15
+ def self.execute
16
+ answer = ""
17
+ score = 0
18
+ @questions.each do |question|
19
+ puts question.prompt
20
+ answer = gets.chomp
21
+ score += 1 if answer == question.answer
32
22
  end
23
+ puts "you got #{score} out of #{@questions.size}"
33
24
  end
34
- puts "you got #{score} out of #{questions.size}"
35
25
  end
36
26
  end
@@ -1,3 +1,3 @@
1
1
  module SunQuiz
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sun_quiz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tham