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

#decode, #initialize

Constructor Details

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

Instance Method Details

#blank_valueObject



100
# File 'lib/dbf/column_type.rb', line 100

def blank_value = false

#skip_blank?Boolean

Returns:



99
# File 'lib/dbf/column_type.rb', line 99

def skip_blank? = true

#type_cast(value) ⇒ Object

Parameters:



103
104
105
106
107
# File 'lib/dbf/column_type.rb', line 103

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