Class: Mods::Date::YearRangeFormat
- Inherits:
-
ExtractorDateFormat
- Object
- Mods::Date
- ExtractorDateFormat
- Mods::Date::YearRangeFormat
- Defined in:
- lib/mods/date.rb
Overview
Full-text extractor for data formatted as YYYY-YYYY or YYY-YYY
Constant Summary collapse
- REGEX =
/(?<start>\d{3,4})-(?<end>\d{3,4})/
Instance Attribute Summary
Attributes inherited from Mods::Date
Class Method Summary collapse
Methods inherited from ExtractorDateFormat
Methods inherited from Mods::Date
#approximate?, #as_range, #encoding, #encoding?, #end?, from_element, #inferred?, #initialize, #key?, parse_date, #point, #precision, #qualifier, #questionable?, #single?, #start?, #text, #to_a, #type
Constructor Details
This class inherits a constructor from Mods::Date
Class Method Details
.normalize_to_edtf(text) ⇒ Object
196 197 198 199 |
# File 'lib/mods/date.rb', line 196 def self.normalize_to_edtf(text) matches = text.match(REGEX) "#{matches[:start].rjust(4, "0")}/#{matches[:end].rjust(4, "0")}" end |