Sha256: 8aed358c5d3ec3d3e7495a13c9c26889346d5e9131ef14ba656971592b4b06cf

Contents?: true

Size: 614 Bytes

Versions: 1

Compression:

Stored size: 614 Bytes

Contents

require 'json'

module OGR
  module StyleTableExtensions
    # Gets all of the styles as Hash.  Note that this calls
    # #reset_style_string_reading.
    #
    # @return [Hash{name => style}]
    def styles
      styles = {}
      reset_style_string_reading

      loop do
        style = next_style
        break unless style
        styles[last_style_name] = style
      end

      reset_style_string_reading

      styles
    end

    # @return [Hash]
    def as_json(_options = nil)
      styles
    end

    # @return [String]
    def to_json(options = nil)
      as_json(options).to_json
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ffi-gdal-1.0.0.beta6 lib/ogr/style_table_extensions.rb