Class: WikidataPositionHistory::Mandate
- Inherits:
-
Object
- Object
- WikidataPositionHistory::Mandate
- Defined in:
- lib/sparql/mandates.rb
Overview
Represents a single row returned from the Mandates query
Instance Method Summary collapse
- #acting? ⇒ Boolean
- #end_date ⇒ Object
- #end_date_precision ⇒ Object
- #end_date_raw ⇒ Object
-
#initialize(row) ⇒ Mandate
constructor
A new instance of Mandate.
- #item ⇒ Object
- #nature ⇒ Object
- #next ⇒ Object
- #ordinal ⇒ Object
- #prev ⇒ Object
- #start_date ⇒ Object
- #start_date_precision ⇒ Object
- #start_date_raw ⇒ Object
Constructor Details
#initialize(row) ⇒ Mandate
Returns a new instance of Mandate.
32 33 34 |
# File 'lib/sparql/mandates.rb', line 32 def initialize(row) @row = row end |
Instance Method Details
#acting? ⇒ Boolean
56 57 58 |
# File 'lib/sparql/mandates.rb', line 56 def acting? nature == 'Q4676846' end |
#end_date ⇒ Object
64 65 66 |
# File 'lib/sparql/mandates.rb', line 64 def end_date QueryService::WikidataDate.new(end_date_raw, end_date_precision) end |
#end_date_precision ⇒ Object
80 81 82 |
# File 'lib/sparql/mandates.rb', line 80 def end_date_precision row.dig(:end_precision, :value) end |
#end_date_raw ⇒ Object
72 73 74 |
# File 'lib/sparql/mandates.rb', line 72 def end_date_raw row.dig(:end_date, :value).to_s[0..9] end |
#item ⇒ Object
40 41 42 |
# File 'lib/sparql/mandates.rb', line 40 def item QueryService::WikidataItem.new(row.dig(:item, :value)).qlink end |
#nature ⇒ Object
52 53 54 |
# File 'lib/sparql/mandates.rb', line 52 def nature QueryService::WikidataItem.new(row.dig(:nature, :value)).id end |
#next ⇒ Object
48 49 50 |
# File 'lib/sparql/mandates.rb', line 48 def next QueryService::WikidataItem.new(row.dig(:next, :value)).qlink end |
#ordinal ⇒ Object
36 37 38 |
# File 'lib/sparql/mandates.rb', line 36 def ordinal row.dig(:ordinal, :value) end |
#prev ⇒ Object
44 45 46 |
# File 'lib/sparql/mandates.rb', line 44 def prev QueryService::WikidataItem.new(row.dig(:prev, :value)).qlink end |
#start_date ⇒ Object
60 61 62 |
# File 'lib/sparql/mandates.rb', line 60 def start_date QueryService::WikidataDate.new(start_date_raw, start_date_precision) end |
#start_date_precision ⇒ Object
76 77 78 |
# File 'lib/sparql/mandates.rb', line 76 def start_date_precision row.dig(:start_precision, :value) end |
#start_date_raw ⇒ Object
68 69 70 |
# File 'lib/sparql/mandates.rb', line 68 def start_date_raw row.dig(:start_date, :value).to_s[0..9] end |