Sha256: fbd52c3ab4a3d839041198a3d02e72d85f4b5d47343f698f35f461cb6aec3a9b

Contents?: true

Size: 1.25 KB

Versions: 9

Compression:

Stored size: 1.25 KB

Contents

# frozen_string_literal: true

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

9 entries across 9 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta16 lib/gdal/version_info.rb
ffi-gdal-1.0.0.beta15 lib/gdal/version_info.rb
ffi-gdal-1.0.0.beta14 lib/gdal/version_info.rb
ffi-gdal-1.0.0.beta13 lib/gdal/version_info.rb
ffi-gdal-1.0.0.beta12 lib/gdal/version_info.rb
ffi-gdal-1.0.0.beta11 lib/gdal/version_info.rb
ffi-gdal-1.0.0.beta10 lib/gdal/version_info.rb
ffi-gdal-1.0.0.beta9 lib/gdal/version_info.rb
ffi-gdal-1.0.0.beta8 lib/gdal/version_info.rb