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:



19
20
21
# File 'lib/infoboxer/tree/linkable.rb', line 19

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

#urlString

Human-readable page URL

Returns:

  • (String)


26
27
28
29
# File 'lib/infoboxer/tree/linkable.rb', line 26

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