Sha256: fcc0298997357ef1be6ff3f6ddbaf71e3ac917128950c7501b64d8cc80e4121e

Contents?: true

Size: 678 Bytes

Versions: 2

Compression:

Stored size: 678 Bytes

Contents

require 'json'

module OGR
  module FeatureDefinitionExtensions

    # @return [Array<OGR::Field>]
    def fields
      0.upto(field_count - 1).map do |i|
        field(i)
      end
    end

    # @param name [String]
    # @return [OGR::Field]
    def field_by_name(name)
      field(field_index(name))
    end

    # @return [Hash]
    def as_json
      {
        field_count: field_count,
        fields: fields.map(&:as_json),
        geometry_field_count: geometry_field_count,
        geometry_type: geometry_type,
        name: name,
        is_style_ignored: style_ignored?
      }
    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/ogr/feature_definition_extensions.rb
ffi-gdal-1.0.0.beta1 lib/ogr/feature_definition_extensions.rb