Class: QueryService::WikidataItem
- Inherits:
-
Object
- Object
- QueryService::WikidataItem
- Defined in:
- lib/query_service.rb
Overview
different views of a Wikidata item
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean
- #id ⇒ Object
-
#initialize(url) ⇒ WikidataItem
constructor
A new instance of WikidataItem.
- #qblink ⇒ Object
- #qblink_i ⇒ Object
- #qlink ⇒ Object
- #qlink_i ⇒ Object
Constructor Details
#initialize(url) ⇒ WikidataItem
Returns a new instance of WikidataItem.
36 37 38 |
# File 'lib/query_service.rb', line 36 def initialize(url) @url = url end |
Instance Method Details
#eql?(other) ⇒ Boolean
40 41 42 |
# File 'lib/query_service.rb', line 40 def eql?(other) id == other.id end |
#id ⇒ Object
44 45 46 |
# File 'lib/query_service.rb', line 44 def id url.split('/').last unless url.to_s.empty? end |
#qblink ⇒ Object
52 53 54 |
# File 'lib/query_service.rb', line 52 def qblink "{{QB|#{id}}}" if id end |
#qblink_i ⇒ Object
60 61 62 |
# File 'lib/query_service.rb', line 60 def qblink_i "''#{qblink}''" if qblink end |
#qlink ⇒ Object
48 49 50 |
# File 'lib/query_service.rb', line 48 def qlink "{{Q|#{id}}}" if id end |
#qlink_i ⇒ Object
56 57 58 |
# File 'lib/query_service.rb', line 56 def qlink_i "''#{qlink}''" if qlink end |