class Infoboxer::MediaWiki::Page

A descendant of {Tree::Document Document}, representing page, received from {MediaWiki} client.

Alongside with document tree structure, knows document's title as represented by MediaWiki and human (non-API) URL.

Constants

PARAMS_TO_INSPECT

Attributes

client[R]

Instance of {MediaWiki} which this page was received from @return {MediaWiki}

source[R]

Instance of MediaWiktory::Page class with source data @return {MediaWiktory::Page}

Public Class Methods

new(client, children, source) click to toggle source
Calls superclass method
# File lib/infoboxer/media_wiki/page.rb, line 11
def initialize(client, children, source)
  @client, @source = client, source
  super(children, title: source['title'], url: source['fullurl'])
end

Public Instance Methods

category?() click to toggle source
# File lib/infoboxer/media_wiki/page.rb, line 43
def category?
  namespace == 'Category'
end
namespace() click to toggle source

FIXME: take from siteinfo!

# File lib/infoboxer/media_wiki/page.rb, line 39
def namespace
  Traits::STANDARD_NAMESPACES[source.fetch('ns') + 2] # Media = -2, Specia = -1, Main = 0
end
traits() click to toggle source
# File lib/infoboxer/media_wiki/page.rb, line 34
def traits
  client.traits
end

Private Instance Methods

show_params() click to toggle source
Calls superclass method
# File lib/infoboxer/media_wiki/page.rb, line 51
def show_params
  super(params.select { |k, _v| PARAMS_TO_INSPECT.include?(k) })
end