Sha256: bcd3f103c3499a869c17082314b707b82ca8d955d2773e1243f71cc936bc91f0

Contents?: true

Size: 735 Bytes

Versions: 2

Compression:

Stored size: 735 Bytes

Contents

require 'json'

module GDAL
  module RasterAttributeTableExtensions

    # Get +column_name+, +column_usage+, +column_type+ as a Hash.
    #
    # @param index [Fixnum]
    # @return [Hash]
    def column(index)
      {
        name: column_name(index),
        usage: column_usage(index),
        type: column_type(index)
      }
    end

    # @return [Array<Hash>]
    def columns
      0.upto(column_count - 1).map do |i|
        column(i)
      end
    end

    # @return [Hash]
    def as_json
      {
        column_count: column_count,
        columns: columns,
        linear_binning: linear_binning,
        row_count: row_count
      }
    end

    # @return [String]
    def to_json
      as_json.to_json
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta3 lib/gdal/raster_attribute_table_extensions.rb
ffi-gdal-1.0.0.beta1 lib/gdal/raster_attribute_table_extensions.rb