Class: QueryService::WikidataItem

Inherits:
Object
  • Object
show all
Defined in:
lib/query_service.rb

Overview

different views of a Wikidata item

Instance Method Summary collapse

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

Returns:

  • (Boolean)


40
41
42
# File 'lib/query_service.rb', line 40

def eql?(other)
  id == other.id
end

#idObject



44
45
46
# File 'lib/query_service.rb', line 44

def id
  url.split('/').last unless url.to_s.empty?
end


52
53
54
# File 'lib/query_service.rb', line 52

def qblink
  "{{QB|#{id}}}" if id
end


60
61
62
# File 'lib/query_service.rb', line 60

def qblink_i
  "''#{qblink}''" if qblink
end


48
49
50
# File 'lib/query_service.rb', line 48

def qlink
  "{{Q|#{id}}}" if id
end


56
57
58
# File 'lib/query_service.rb', line 56

def qlink_i
  "''#{qlink}''" if qlink
end