Sha256: 1502316646f7d0744d8d1ad5e6720645576c2bd2e5f5ee4113b13e503e03c751
Contents?: true
Size: 1.35 KB
Versions: 2
Compression:
Stored size: 1.35 KB
Contents
module Infoboxer class MediaWiki # 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. class Page < Tree::Document def initialize(client, children, source) @client, @source = client, source super(children, title: source['title'], url: source['fullurl']) end # Instance of {MediaWiki} which this page was received from # @return {MediaWiki} attr_reader :client # Instance of MediaWiktory::Page class with source data # @return {MediaWiktory::Page} attr_reader :source # @!attribute [r] title # Page title. # @return [String] # @!attribute [r] url # Page friendly URL. # @return [String] def_readers :title, :url def traits client.traits end # FIXME: take from siteinfo! def namespace Traits::STANDARD_NAMESPACES[source.fetch('ns') + 2] # Media = -2, Specia = -1, Main = 0 end def category? namespace == 'Category' end private PARAMS_TO_INSPECT = %i[url title].freeze def show_params super(params.select { |k, _v| PARAMS_TO_INSPECT.include?(k) }) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
infoboxer-0.3.3 | lib/infoboxer/media_wiki/page.rb |
infoboxer-0.3.2 | lib/infoboxer/media_wiki/page.rb |