Sha256: f0f80c2693386c9e9e056ee2e4a655681b4a20e48e41c69dd37637fe5bcb6d0d

Contents?: true

Size: 1.25 KB

Versions: 3

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 [Integer]
    # @param minor [Integer]
    # @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

3 entries across 3 versions & 1 rubygems

Version Path
ffi-gdal-1.1.0 lib/gdal/version_info.rb
ffi-gdal-1.0.4 lib/gdal/version_info.rb
ffi-gdal-1.0.3 lib/gdal/version_info.rb