quiz 0.2.0 → 0.2.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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/lib/quiz.rb +21 -8
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ea7a819290177873e284f04dec125f17c542bc6
|
4
|
+
data.tar.gz: 91ede1a3c2d54a8e5f16192e2a75150ef44c983e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84f8d3edc03a2ecf33a63878b98165fa8d275844053a163466d06d29de904a3e1618f04a19ec30b406b9e97c8d862aee9728a79e5ecfea2672cf19db501da960
|
7
|
+
data.tar.gz: 902a3d7fb2d420d753ad015ae50abf3d25c599666371c5f5ca2b8926d9dd3aea298b35cd3edcdd267c93367a84f0748bfb39e48f749b1399944d1881b2c17caa
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/lib/quiz.rb
CHANGED
@@ -12,17 +12,19 @@ class Quiz
|
|
12
12
|
def initialize(x)
|
13
13
|
|
14
14
|
s, type = RXFHelper.read(x)
|
15
|
-
|
16
|
-
xml = case type
|
15
|
+
|
16
|
+
xml = case type
|
17
17
|
when :xml then
|
18
18
|
s
|
19
19
|
when :unknown
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
RowX
|
20
|
+
parse_rowx(s)
|
21
|
+
when :file
|
22
|
+
|
23
|
+
# is it a loose RowX document or is it XML?
|
24
|
+
s[0] == '<' ? s : parse_rowx(s)
|
25
|
+
|
24
26
|
end
|
25
|
-
|
27
|
+
|
26
28
|
@doc = Document.new(xml)
|
27
29
|
|
28
30
|
end
|
@@ -65,4 +67,15 @@ class Quiz
|
|
65
67
|
your_score = "you scored %s%" % percent.to_i
|
66
68
|
|
67
69
|
end
|
68
|
-
|
70
|
+
|
71
|
+
private
|
72
|
+
|
73
|
+
def parse_rowx(s)
|
74
|
+
|
75
|
+
lines = s.strip.lines
|
76
|
+
title = lines.first
|
77
|
+
title.prepend 'title: ' unless title =~ /^title:/
|
78
|
+
RowX.new(lines.join).to_xml
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|
metadata
CHANGED
metadata.gz.sig
CHANGED
Binary file
|