Class: WikidataPositionHistory::Report
- Inherits:
-
Object
- Object
- WikidataPositionHistory::Report
- Defined in:
- lib/wikidata_position_history/report.rb
Overview
The entire wikitext generated for this report
Instance Attribute Summary collapse
-
#position_id ⇒ Object
readonly
Returns the value of attribute position_id.
-
#template_class ⇒ Object
readonly
Returns the value of attribute template_class.
Instance Method Summary collapse
- #header ⇒ Object
-
#initialize(position_id, template_class = ReportTemplate) ⇒ Report
constructor
A new instance of Report.
- #position_dates ⇒ Object
- #wikitext ⇒ Object
- #wikitext_with_header ⇒ Object
Constructor Details
#initialize(position_id, template_class = ReportTemplate) ⇒ Report
Returns a new instance of Report.
45 46 47 48 |
# File 'lib/wikidata_position_history/report.rb', line 45 def initialize(position_id, template_class = ReportTemplate) @position_id = position_id @template_class = template_class end |
Instance Attribute Details
#position_id ⇒ Object (readonly)
Returns the value of attribute position_id.
50 51 52 |
# File 'lib/wikidata_position_history/report.rb', line 50 def position_id @position_id end |
#template_class ⇒ Object (readonly)
Returns the value of attribute template_class.
50 51 52 |
# File 'lib/wikidata_position_history/report.rb', line 50 def template_class @template_class end |
Instance Method Details
#header ⇒ Object
58 59 60 |
# File 'lib/wikidata_position_history/report.rb', line 58 def header "== {{Q|#{position_id}}} officeholders #{position_dates} ==" end |
#position_dates ⇒ Object
62 63 64 65 66 67 |
# File 'lib/wikidata_position_history/report.rb', line 62 def position_dates dates = [.inception_date, .abolition_date] return '' if dates.compact.empty? format('(%s)', dates.join(' – ')) end |
#wikitext ⇒ Object
52 53 54 55 56 |
# File 'lib/wikidata_position_history/report.rb', line 52 def wikitext return no_items_output if mandates.empty? output end |
#wikitext_with_header ⇒ Object
69 70 71 |
# File 'lib/wikidata_position_history/report.rb', line 69 def wikitext_with_header [header, wikitext].join("\n") end |