Class: WikidataPositionHistory::OutputRow::Mandate
- Inherits:
-
Object
- Object
- WikidataPositionHistory::OutputRow::Mandate
- Defined in:
- lib/wikidata_position_history/output_row.rb
Overview
Date for a single mandate row, to be passed to the report template
Constant Summary collapse
- CHECKS =
[Check::MissingFields, Check::Overlap, Check::WrongPredecessor, Check::MissingPredecessor, Check::WrongSuccessor, Check::MissingSuccessor].freeze
Instance Method Summary collapse
- #acting? ⇒ Boolean
- #dates ⇒ Object
-
#initialize(later, current, earlier) ⇒ Mandate
constructor
A new instance of Mandate.
- #officeholder ⇒ Object
- #ordinal_string ⇒ Object
- #party ⇒ Object
- #warnings ⇒ Object
Constructor Details
#initialize(later, current, earlier) ⇒ Mandate
Returns a new instance of Mandate.
14 15 16 17 18 |
# File 'lib/wikidata_position_history/output_row.rb', line 14 def initialize(later, current, earlier) @later = later @current = current @earlier = earlier end |
Instance Method Details
#acting? ⇒ Boolean
40 41 42 |
# File 'lib/wikidata_position_history/output_row.rb', line 40 def acting? current.acting? end |
#dates ⇒ Object
33 34 35 36 37 38 |
# File 'lib/wikidata_position_history/output_row.rb', line 33 def dates dates = [current.start_date, current.end_date] return '' if dates.compact.empty? dates.join(' – ') end |
#officeholder ⇒ Object
29 30 31 |
# File 'lib/wikidata_position_history/output_row.rb', line 29 def officeholder current.officeholder end |
#ordinal_string ⇒ Object
20 21 22 23 |
# File 'lib/wikidata_position_history/output_row.rb', line 20 def ordinal_string ordinal = current.ordinal or return '' "#{ordinal}." end |
#party ⇒ Object
25 26 27 |
# File 'lib/wikidata_position_history/output_row.rb', line 25 def party current.party end |
#warnings ⇒ Object
44 45 46 |
# File 'lib/wikidata_position_history/output_row.rb', line 44 def warnings CHECKS.map { |klass| klass.new(later, current, earlier) }.select(&:problem?) end |