class WikidataPositionHistory::SPARQL::QueryRow
Abstract class to represents a single row returned from a query
Attributes
row[R]
Public Class Methods
new(row)
click to toggle source
# File lib/sparql/item_query.rb, line 40 def initialize(row) @row = row end
Protected Instance Methods
date_from(key, precision_key)
click to toggle source
# File lib/sparql/item_query.rb, line 55 def date_from(key, precision_key) trunc = raw(key).to_s[0..9] return if trunc.empty? QueryService::WikidataDate.new(trunc, raw(precision_key)) end
item_from(key)
click to toggle source
# File lib/sparql/item_query.rb, line 48 def item_from(key) value = raw(key) return if value.to_s.empty? QueryService::WikidataItem.new(value) end
raw(key)
click to toggle source
# File lib/sparql/item_query.rb, line 62 def raw(key) row.dig(key, :value) end