Class: MediaWiki::MediaWikiBase::Page

Inherits:
Object
  • Object
show all
Defined in:
lib/mediawiki.rb

Overview

Page encapsulates the properties of wikipedia page.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(page) ⇒ Page

Returns a new instance of Page.



112
113
114
115
116
117
118
119
120
121
# File 'lib/mediawiki.rb', line 112

def initialize(page)
  @title = page.attributes['title']
  @pageid = page.attributes['pageid']
  @links = (page/:links/:pl).collect{|pl| pl.attributes['title']}
  @langlinks = (page/:langlinks/:ll).collect{|ll| ll.attributes['lang']}
  @images = (page/:images/:im).collect{|im| im.attributes['title']}
  @templates = (page/:templates/:tl).collect{|tl| tl.attributes['title']}
  @extlinks = (page/:extlinks/:el).collect{|el| el.inner_html}
  @revisions = (page/:revisions/:rev).collect{|rev| Revision.new(rev)}
end

Instance Attribute Details

#pageidObject

Returns the value of attribute pageid.



110
111
112
# File 'lib/mediawiki.rb', line 110

def pageid
  @pageid
end

#titleObject

Returns the value of attribute title.



110
111
112
# File 'lib/mediawiki.rb', line 110

def title
  @title
end