class WikidataPositionHistory::Metadata
Data about the position itself, to be passed to the report template
Attributes
rows[R]
Public Class Methods
new(rows)
click to toggle source
# File lib/wikidata_position_history/report.rb, line 43 def initialize(rows) @rows = rows end
Public Instance Methods
abolition()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 63 def abolition @abolition ||= OutputRow::Abolition.new(self) end
abolition_dates()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 98 def abolition_dates rows.map(&:abolition_date).compact.uniq(&:to_s).sort end
constituency?()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 77 def constituency? # this should be the same everywhere rows.map(&:constituency?).first end
inception()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 59 def inception @inception ||= OutputRow::Inception.new(self) end
inception_dates()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 94 def inception_dates rows.map(&:inception_date).compact.uniq(&:to_s).sort end
legislator?()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 72 def legislator? # this should be the same everywhere rows.map(&:legislator?).first end
position()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 47 def position rows.map(&:item).first end
position?()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 67 def position? # this should be the same everywhere rows.map(&:position?).first end
predecessor()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 51 def predecessor @predecessor ||= OutputRow::Predecessor.new(self) end
replaced_by_combined()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 90 def replaced_by_combined @replaced_by_combined ||= ImpliedList.new(uniq_by_id(:replaced_by), uniq_by_id(:derived_replaced_by)) end
replaces_combined()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 86 def replaces_combined @replaces_combined ||= ImpliedList.new(uniq_by_id(:replaces), uniq_by_id(:derived_replaces)) end
representative_count()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 82 def representative_count rows.map(&:representative_count).max end
successor()
click to toggle source
# File lib/wikidata_position_history/report.rb, line 55 def successor @successor ||= OutputRow::Successor.new(self) end
Private Instance Methods
uniq_by_id(method)
click to toggle source
# File lib/wikidata_position_history/report.rb, line 106 def uniq_by_id(method) rows.map(&method).compact.uniq(&:id).sort_by(&:id) end