Class: ADT::ColumnType::ShortInteger

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

Instance Method Summary collapse

Instance Method Details

#flagObject



70
71
72
# File 'lib/adt/column_type.rb', line 70

def flag
  'i'
end

#type_cast(value, _table) ⇒ Object



64
65
66
67
68
# File 'lib/adt/column_type.rb', line 64

def type_cast(value, _table)
  return nil if value.strip.empty?

  value.unpack('S_').dig(0).to_i == 2_147_483_648 ? nil : value.unpack('S_').dig(0).to_i
end