Module: NumericAsDataType

Included in:
Numeric
Defined in:
lib/ext/numeric_as_data_type.rb

Instance Method Summary collapse

Instance Method Details

#to_data_type(data_type) ⇒ Object

Parameters:



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/ext/numeric_as_data_type.rb', line 5

def to_data_type(data_type)
  case data_type
  when :GDT_Byte, :GDT_Int8, :GDT_UInt16, :GDT_Int16, :GDT_UInt32, :GDT_Int32, :GDT_UInt64, :GDT_Int64
    to_i
  when :GDT_Float32, :GDT_Float64
    to_f
  when :GDT_CInt16, :GDT_CInt32, :GDT_CFloat32, :GDT_CFloat64
    to_c
  else
    self
  end
end