Sha256: 8da13b7322d270bf007d82886fd4b8af90f8fee7e28b37d1324ed3592b3f133f

Contents?: true

Size: 1.25 KB

Versions: 4

Compression:

Stored size: 1.25 KB

Contents

require_relative '../ffi/gdal'
require 'date'

module GDAL
  module VersionInfo
    # Version in the form "1170".
    #
    # @return [String]
    def version_num
      FFI::GDAL.GDALVersionInfo('VERSION_NUM')
    end

    # @return [Date]
    def release_date
      Date.parse(FFI::GDAL.GDALVersionInfo('RELEASE_DATE'))
    end

    # Version in the form "1.1.7".
    #
    # @return [String]
    def release_name
      FFI::GDAL.GDALVersionInfo('RELEASE_NAME')
    end

    # The long licensing info.
    #
    # @return [String]
    def license
      FFI::GDAL.GDALVersionInfo('LICENSE')
    end

    # Options used when building GDAL.
    #
    # @return [Hash{String => String}]
    def build_info
      key_value_pairs = FFI::GDAL.GDALVersionInfo('BUILD_INFO')
      key_value_pairs.split.each_with_object({}) do |kv, obj|
        key, value = kv.split('=', 2)
        obj[key] = value
      end
    end

    # @return [String]
    def long_version
      FFI::GDAL.GDALVersionInfo('--version')
    end

    # @param major [Fixnum]
    # @param minor [Fixnum]
    # @return [Boolean] +true+ if the runtime GDAL library matches the given
    #   version params.
    def check_version(major, minor)
      FFI::GDAL.GDALCheckVersion(major, minor, 'FFI::GDAL')
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta5 lib/gdal/version_info.rb
ffi-gdal-1.0.0.beta4 lib/gdal/version_info.rb
ffi-gdal-1.0.0.beta3 lib/gdal/version_info.rb
ffi-gdal-1.0.0.beta1 lib/gdal/version_info.rb