Class: DBF::ColumnType::AutoIncrement

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, #skip_blank?

Constructor Details

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

Instance Method Details

#type_cast(value) ⇒ Object

Parameters:



66
67
68
69
70
# File 'lib/dbf/column_type.rb', line 66

def type_cast(value)
  bits = value.unpack1('B*')
  sign_multiplier = bits[0] == '0' ? -1 : 1
  bits[1, 31].to_i(2) * sign_multiplier
end