Class: DBF::ColumnType::Date

Inherits:
Base
  • Object
show all
Defined in:
lib/dbf/column_type.rb

Instance Attribute Summary

Attributes inherited from Base

#decimal, #encoding

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from DBF::ColumnType::Base

Instance Method Details

#type_cast(value) ⇒ Object

Parameters:



75
76
77
78
79
# File 'lib/dbf/column_type.rb', line 75

def type_cast(value)
  value.match?(/\d{8}/) && ::Date.strptime(value, '%Y%m%d')
rescue StandardError
  nil
end