Class: Wikipedia::VandalismDetection::Page

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initializePage

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

#idObject

Returns the value of attribute id.



13
14
15
# File 'lib/wikipedia/vandalism_detection/page.rb', line 13

def id
  @id
end

#revisionsObject (readonly)

Returns the value of attribute revisions.



14
15
16
# File 'lib/wikipedia/vandalism_detection/page.rb', line 14

def revisions
  @revisions
end

#titleObject

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

#editsObject



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_editsObject



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