Class: WikidataPositionHistory::Check::Overlap

Inherits:
WikidataPositionHistory::Check show all
Defined in:
lib/wikidata_position_history/checks.rb

Overview

Does the end date overlap with the successor’s start date?

Instance Method Summary collapse

Methods inherited from WikidataPositionHistory::Check

#explanation, #initialize

Constructor Details

This class inherits a constructor from WikidataPositionHistory::Check

Instance Method Details

#headlineObject



165
166
167
# File 'lib/wikidata_position_history/checks.rb', line 165

def headline
  comparable? ? 'Date overlap' : 'Date precision'
end

#possible_explanationObject



169
170
171
# File 'lib/wikidata_position_history/checks.rb', line 169

def possible_explanation
  "#{current.item} has a {{P|582}} of #{current.end_date}, which #{overlap_explanation} the {{P|580}} of #{later.start_date} for #{later.item}"
end

#problem?Boolean

Returns:

  • (Boolean)


154
155
156
157
158
159
160
161
162
163
# File 'lib/wikidata_position_history/checks.rb', line 154

def problem?
  return false unless later

  next_starts = later.start_date or return false
  ends = current.end_date or return false

  ends > next_starts
rescue ArgumentError
  true
end