module NumericAsDataType

Public Instance Methods

to_data_type(data_type) click to toggle source

@param data_type [FFI::GDAL::GDAL::DataType]

# 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