Class: Dcc::Validate::Schematron::Rules::DateRangeCheck
- Inherits:
-
Base
- Object
- Dcc::Validate::Schematron::Rule
- Base
- Dcc::Validate::Schematron::Rules::DateRangeCheck
- Defined in:
- lib/dcc/validate/schematron/rules/date_range_check.rb
Overview
Errors if endPerformanceDate precedes beginPerformanceDate.
Instance Method Summary collapse
Methods inherited from Dcc::Validate::Schematron::Rule
Instance Method Details
#check_on(dcc) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/dcc/validate/schematron/rules/date_range_check.rb', line 10 def check_on(dcc) return [] unless Dcc::TypeGuards.has_attribute?(dcc, :administrative_data) core = safe_attr(dcc.administrative_data, :core_data) return [] if core.nil? begin_d = Dcc::TypeGuards.has_attribute?(core, :begin_performance_date) ? core.begin_performance_date : nil end_d = Dcc::TypeGuards.has_attribute?(core, :end_performance_date) ? core.end_performance_date : nil return [] if begin_d.nil? || end_d.nil? return [] unless end_d < begin_d [ issue( severity: :error, message: "endPerformanceDate (#{end_d}) precedes beginPerformanceDate (#{begin_d})", ), ] end |