Module: Infoboxer::Tree::Linkable

Included in:
Template, Wikilink
Defined in:
lib/infoboxer/tree/linkable.rb

Overview

Module included into everything, that can be treated as link to some MediaWiki page, despite of behavior. Namely, Wikilink and Template.

Instance Method Summary collapse

Instance Method Details

#followMediaWiki::Page

Extracts wiki page by this link and returns it parsed (or nil, if page not found).

About template "following" see also Template#follow docs.

See also:

Returns:



17
18
19
# File 'lib/infoboxer/tree/linkable.rb', line 17

def follow
  client.get(link, interwiki: interwiki)
end

#urlString

Human-readable page URL

Returns:

  • (String)


24
25
26
27
# File 'lib/infoboxer/tree/linkable.rb', line 24

def url
  # FIXME: fragile as hell.
  page.url.sub(%r{[^/]+$}, link.tr(' ', '_'))
end