Class: Mods::Date::CenturyFormat
- Inherits:
-
ExtractorDateFormat
- Object
- Mods::Date
- ExtractorDateFormat
- Mods::Date::CenturyFormat
- Defined in:
- lib/mods/date.rb
Overview
Full-text extractor for dates given as centuries
Constant Summary collapse
- REGEX =
/(?<century>\d{2})th C(entury)?/i
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
205 206 207 208 |
# File 'lib/mods/date.rb', line 205 def self.normalize_to_edtf(text) matches = text.match(REGEX) "#{matches[:century].to_i - 1}XX" end |