Class: DBF::ColumnType::Number

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

#blank_value, #decode, #initialize

Constructor Details

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

Instance Method Details

#skip_blank?Boolean

Returns:



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

def skip_blank? = true

#type_cast(value) ⇒ Object

Parameters:



43
44
45
46
47
# File 'lib/dbf/column_type.rb', line 43

def type_cast(value)
  return nil if value.empty?

  decimal.zero? ? value.to_i : value.to_f
end