Class: Wikipedia::VandalismDetection::Page
- Inherits:
-
Object
- Object
- Wikipedia::VandalismDetection::Page
- Defined in:
- lib/wikipedia/vandalism_detection/page.rb
Overview
Represents a full wikipedia page history.
Constant Summary collapse
- START_TAG =
'<page>'.freeze
- END_TAG =
'</page>'.freeze
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#revisions ⇒ Object
readonly
Returns the value of attribute revisions.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
- #add_revision(revision) ⇒ Object
- #edits ⇒ Object
-
#initialize ⇒ Page
constructor
A new instance of Page.
- #reverted_edits ⇒ Object
Constructor Details
#initialize ⇒ Page
Returns a new instance of Page.
16 17 18 19 20 21 |
# File 'lib/wikipedia/vandalism_detection/page.rb', line 16 def initialize @revisions = {} @edits = [] @update_edits = false @update_reverted_edits = false end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
13 14 15 |
# File 'lib/wikipedia/vandalism_detection/page.rb', line 13 def id @id end |
#revisions ⇒ Object (readonly)
Returns the value of attribute revisions.
14 15 16 |
# File 'lib/wikipedia/vandalism_detection/page.rb', line 14 def revisions @revisions end |
#title ⇒ Object
Returns the value of attribute title.
13 14 15 |
# File 'lib/wikipedia/vandalism_detection/page.rb', line 13 def title @title end |
Instance Method Details
#add_revision(revision) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/wikipedia/vandalism_detection/page.rb', line 23 def add_revision(revision) @revisions[revision.id] = revision @update_edits = true @update_reverted_edits = true end |
#edits ⇒ Object
30 31 32 33 |
# File 'lib/wikipedia/vandalism_detection/page.rb', line 30 def edits @edits = create_edits_from @revisions if @update_edits @edits end |
#reverted_edits ⇒ Object
35 36 37 38 |
# File 'lib/wikipedia/vandalism_detection/page.rb', line 35 def reverted_edits @reverted_edits = create_reverted_edits_from @revisions if @update_reverted_edits @reverted_edits end |