Class: GimmeWikidata::SearchResult

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

Overview

TODO: DOCUMENT THIS CLASS

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, label, description) ⇒ SearchResult

Returns a new instance of SearchResult.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/gimme_wikidata/search.rb', line 37

def initialize(id, label, description)
  @id = id
  @label = label
  @description = description

  case @id[0]
  when 'Q'
    @type = Item
  when 'P'
    @type = Property
  else
    @type = :unknown_type
  end
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



35
36
37
# File 'lib/gimme_wikidata/search.rb', line 35

def description
  @description
end

#idObject

Returns the value of attribute id.



35
36
37
# File 'lib/gimme_wikidata/search.rb', line 35

def id
  @id
end

#labelObject

Returns the value of attribute label.



35
36
37
# File 'lib/gimme_wikidata/search.rb', line 35

def label
  @label
end

#typeObject

Returns the value of attribute type.



35
36
37
# File 'lib/gimme_wikidata/search.rb', line 35

def type
  @type
end