Class: Datanorm::Headers::V4::Date

Inherits:
Object
  • Object
show all
Includes:
Calls
Defined in:
lib/datanorm/headers/v4/date.rb

Overview

Parses a Date from the raw first line of a DATANORM file.

Instance Method Summary collapse

Instance Method Details

#callObject



12
13
14
15
16
17
# File 'lib/datanorm/headers/v4/date.rb', line 12

def call
  return unless ddmmyy.match?(/\A\d{6}\z/)

  year = (yy < 50 ? 2000 : 1900) + yy
  ::Date.new(year, mm, dd)
end