Class: Wikidatum::Sitelink
- Inherits:
-
Object
- Object
- Wikidatum::Sitelink
- Defined in:
- lib/wikidatum/sitelink.rb
Overview
Wikidatum::Sitelinks represent associated sitelinks on a Wikidata item, for example the associated English Wikipedia article.
Instance Attribute Summary collapse
-
#badges ⇒ Array<String>
readonly
An array of badges, given as item IDs (e.g.
['Q123', 'Q124']
). -
#site ⇒ String
readonly
The shortcode for the given site (e.g. ‘enwiki’, ‘commons’, etc.).
-
#title ⇒ String
readonly
The title of the page in the associated Wikimedia site.
Instance Method Summary collapse
Instance Attribute Details
#badges ⇒ Array<String> (readonly)
Returns An array of badges, given as item IDs (e.g. ['Q123', 'Q124']
).
13 14 15 |
# File 'lib/wikidatum/sitelink.rb', line 13 def badges @badges end |
#site ⇒ String (readonly)
Returns The shortcode for the given site (e.g. ‘enwiki’, ‘commons’, etc.).
7 8 9 |
# File 'lib/wikidatum/sitelink.rb', line 7 def site @site end |
#title ⇒ String (readonly)
Returns The title of the page in the associated Wikimedia site.
10 11 12 |
# File 'lib/wikidatum/sitelink.rb', line 10 def title @title end |
Instance Method Details
#inspect ⇒ String
37 38 39 |
# File 'lib/wikidatum/sitelink.rb', line 37 def inspect "<Wikidatum::Sitelink site=#{@site.inspect} title=#{@title.inspect} badges=#{@badges.inspect}>" end |
#to_h ⇒ Hash
28 29 30 31 32 33 34 |
# File 'lib/wikidatum/sitelink.rb', line 28 def to_h { site: @site, title: @title, badges: @badges } end |