Module: GDV::Format

Defined in:
lib/gdv/format/line.rb,
lib/gdv/format/parser.rb,
lib/gdv/format/reader.rb,
lib/gdv/format/rectype.rb,
lib/gdv/format/recindex.rb,
lib/gdv/format/classifier.rb

Defined Under Namespace

Classes: Classifier, Field, FormatError, Line, MatchError, ParseError, Parser, Part, Path, Reader, ReaderError, RecIndex, RecType, Record, RecordError, RecordSizeError, UnknownRecordError, ValueMap

Constant Summary collapse

YAML_URI =

The URI we use for our YAML objects. The date indicates the date of the underlying GDV release

"tag:opengdv.vendis.org,2009-11-01"

Class Method Summary collapse

Class Method Details

.parse_date(s) ⇒ Date

Parse a date; the string s must be exactly 8 bytes, in the format MMTTJJJJ.


19
20
21
22
23
24
25
26
27
# File 'lib/gdv/format/rectype.rb', line 19

def self.parse_date(s)
    d = s[0,2].to_i
    m = s[2,2].to_i
    y = s[4,4].to_i
    return nil if y + m + d == 0
    d = 1 if d == 0
    m = 1 if m == 0
    Date.civil(y,m,d)
end