Sha256: 460c3459d8877d5535883fe59ab739651cd6ee77d0910d87d8a667a51ae98a8d

Contents?: true

Size: 410 Bytes

Versions: 2

Compression:

Stored size: 410 Bytes

Contents

module NumericAsDataType
  # @param data_type [FFI::GDAL::GDAL::DataType]
  def to_data_type(data_type)
    case data_type
    when :GDT_Byte, :GDT_UInt16, :GDT_Int16, :GDT_UInt32, :GDT_Int32
      to_i
    when :GDT_Float32, :GDT_Float64
      to_f
    when :GDT_CInt16, :GDT_CInt32, :GDT_CFloat32, :GDT_CFloat64
      to_c
    else
      self
    end
  end
end

class Numeric
  include NumericAsDataType
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta7 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.0.beta6 lib/ext/numeric_as_data_type.rb