Sha256: 1da4b1a29bf6ec1ca5870b7b5d16855016593ee04d1f175e9552ba938cca1fee

Contents?: true

Size: 441 Bytes

Versions: 14

Compression:

Stored size: 441 Bytes

Contents

# frozen_string_literal: true

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

14 entries across 14 versions & 1 rubygems

Version Path
ffi-gdal-1.0.4 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.3 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.2 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.1 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.0 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.0.beta16 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.0.beta15 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.0.beta14 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.0.beta13 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.0.beta12 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.0.beta11 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.0.beta10 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.0.beta9 lib/ext/numeric_as_data_type.rb
ffi-gdal-1.0.0.beta8 lib/ext/numeric_as_data_type.rb