wikiavro 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c64ef5f767535d9432d8f589411f76dedb6a4b04
4
- data.tar.gz: b846af138fe797fa09e9f248bcdb3298e988b5fb
3
+ metadata.gz: e56d6fb651af9c0df1f835aab0f48a0a57f4ebed
4
+ data.tar.gz: 267e2c2e40288b7f2beddbf398821974291ee86f
5
5
  SHA512:
6
- metadata.gz: b5f7cba59679bc913ceaddf95e97f8ed7c63d9f54660d81680db419da09abf2c61ddadd2f2a75b0e199fbfe9f710363edcd889550f76f44acdd6a34e591f69a2
7
- data.tar.gz: 8b63a6ae13ce31cc31eb2f5698a0bd586c9645dfbce1be6ae52e45f90315af3015ed1e1f17badaa4f06425483369a369af6adefd0dae2c8ef0555d8f05193f01
6
+ metadata.gz: b55e5f44171be03a61cb354a965667ec0b47c31f5abe1cde35dc916cc61ca8f826f0ff1a457b53906db3dd16b280237838016c9375fff86fa0601852a2c0fbe9
7
+ data.tar.gz: b223451fe16a6d0c53e4b7651e72e8fc181152a433085403e2e584c08f481de254e659336424ae8109a5bbc4f1deab3072e60269e7c9157ce2b227b234329a42
@@ -1,5 +1,5 @@
1
1
  module WikiAvro
2
- Version = '0.0.1'
2
+ Version = '0.0.2'
3
3
  end
4
4
 
5
5
  require 'wikiavro/mediawiki'
@@ -50,7 +50,14 @@ EOS
50
50
  ]
51
51
  }]},
52
52
  {"name": "minor", "type": "boolean"},
53
- {"name": "comment", "type": ["null", "string"]},
53
+ {"name": "comment", "type": ["null", {
54
+ "namespace": "org.rationalwiki",
55
+ "name": "Comment",
56
+ "type": "record",
57
+ "fields": [
58
+ {"name": "comment", "type": ["null", "string"]}
59
+ ]
60
+ }]},
54
61
  {"name": "bytes", "type": "long"},
55
62
  {"name": "textid", "type": ["null", "string"]},
56
63
  {"name": "text", "type": ["null", "string"]}
@@ -152,11 +159,17 @@ EOS
152
159
  contributor = nil
153
160
  end
154
161
 
155
- if comment[:deleted].nil?
156
- comment = comment[:comment]
157
- else
158
- raise 'deleted comment has content' if comment[:comment]
159
- comment = nil
162
+ if !comment.nil?
163
+ if !(comment[:deleted].nil? ^ comment[:comment].nil?)
164
+ raise 'comment[:deleted] and comment[:comment] should alternate'
165
+ end
166
+
167
+ if comment[:deleted].nil?
168
+ comment[:comment]
169
+ else
170
+ comment.delete :deleted
171
+ comment[:comment] = nil
172
+ end
160
173
  end
161
174
 
162
175
  text = nil if !text_deleted.nil?
@@ -166,7 +179,7 @@ EOS
166
179
  'n' => n.to_i,
167
180
  'timestamp' => timestamp,
168
181
  'contributor' => contributor,
169
- 'minor' => minor.nil?,
182
+ 'minor' => !!minor,
170
183
  'comment' => comment,
171
184
  'bytes' => bytes.to_i,
172
185
  'textid' => textid,
@@ -396,9 +396,13 @@ module WikiAvro::MediaWiki
396
396
  end
397
397
  end
398
398
 
399
- class Minor < WikiAvro::XML::Inserter
400
- def initialize
401
- super('minor')
399
+ class Minor < WikiAvro::XML::Leaf
400
+ def name
401
+ 'minor'
402
+ end
403
+
404
+ def parse_attributes(w, p, r)
405
+ p.minor = true
402
406
  end
403
407
  end
404
408
 
@@ -450,15 +454,15 @@ module WikiAvro::MediaWiki
450
454
  end
451
455
 
452
456
  def reset
453
- id = nil
454
- timestamp = nil
455
- contributor = nil
456
- minor = nil
457
- comment = nil
458
- text_deleted = nil
459
- bytes = nil
460
- textid = nil
461
- text = nil
457
+ @id = nil
458
+ @timestamp = nil
459
+ @contributor = nil
460
+ @minor = nil
461
+ @comment = nil
462
+ @text_deleted = nil
463
+ @bytes = nil
464
+ @textid = nil
465
+ @text = nil
462
466
  end
463
467
 
464
468
  def handle_content(w, p, r)
@@ -571,16 +575,16 @@ module WikiAvro::MediaWiki
571
575
  end
572
576
 
573
577
  def reset
574
- threadSubject = nil
575
- threadParent = nil
576
- threadAncestor = nil
577
- threadPage = nil
578
- threadID = nil
579
- threadSummaryPage = nil
580
- threadAuthor = nil
581
- threadEditStatus = nil
582
- threadType = nil
583
- threadSignature = nil
578
+ @threadSubject = nil
579
+ @threadParent = nil
580
+ @threadAncestor = nil
581
+ @threadPage = nil
582
+ @threadID = nil
583
+ @threadSummaryPage = nil
584
+ @threadAuthor = nil
585
+ @threadEditStatus = nil
586
+ @threadType = nil
587
+ @threadSignature = nil
584
588
  end
585
589
 
586
590
  def handle_content(w, p, r)
@@ -620,12 +624,12 @@ module WikiAvro::MediaWiki
620
624
  end
621
625
 
622
626
  def reset
623
- title = nil
624
- ns = nil
625
- id = nil
626
- redirect = nil
627
- sha1 = nil
628
- revision_count = nil
627
+ @title = nil
628
+ @ns = nil
629
+ @id = nil
630
+ @redirect = nil
631
+ @sha1 = nil
632
+ @revision_count = nil
629
633
  @revision_count = 0
630
634
  end
631
635
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wikiavro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Someon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-06 00:00:00.000000000 Z
11
+ date: 2015-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: libxml-ruby