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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69d07124bff92e24ea789c418c5f9cd083eefc53
4
- data.tar.gz: ca20ff236417a73f9590c3c041ac8d3913b3065f
3
+ metadata.gz: 0ea7a819290177873e284f04dec125f17c542bc6
4
+ data.tar.gz: 91ede1a3c2d54a8e5f16192e2a75150ef44c983e
5
5
  SHA512:
6
- metadata.gz: 96c1736b2cc79bc8d9a1a7e5ac1d09f43ead7bf7cf7e5361da07b4444e0c37b7385f8c89f0332f5fd51252956bb3eee050dc03644adda7312b40e3e7c1c8cad6
7
- data.tar.gz: 2385e5c42762f8974194afc0e931dff01523cfa3227f9505b693a7b7460fe9ecdf8ffd43aa122ce844ad5aeab35cf140dc4d2972bd98f09ea1f882bf941a3007
6
+ metadata.gz: 84f8d3edc03a2ecf33a63878b98165fa8d275844053a163466d06d29de904a3e1618f04a19ec30b406b9e97c8d862aee9728a79e5ecfea2672cf19db501da960
7
+ data.tar.gz: 902a3d7fb2d420d753ad015ae50abf3d25c599666371c5f5ca2b8926d9dd3aea298b35cd3edcdd267c93367a84f0748bfb39e48f749b1399944d1881b2c17caa
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -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
- lines = s.strip.lines
21
- title = lines.first
22
- title.prepend 'title: ' unless title =~ /^title:/
23
- RowX.new(lines.join).to_xml
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
- end
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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quiz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file