class Geos::GeoJSONWriter
Attributes
indentation[RW]
ptr[R]
Public Class Methods
new(options = {})
click to toggle source
# File lib/ffi-geos/geojson_writer.rb, line 8 def initialize(options = {}) options = { indentation: -1 }.merge(options) ptr = FFIGeos.GEOSGeoJSONWriter_create_r(Geos.current_handle_pointer) @ptr = FFI::AutoPointer.new( ptr, self.class.method(:release) ) set_options(options) end
Public Instance Methods
write(geom, options = nil)
click to toggle source
Options can be set temporarily for individual writes using an options Hash. Options include :indentation.
# File lib/ffi-geos/geojson_writer.rb, line 35 def write(geom, options = nil) unless options.nil? old_options = { indentation: indentation } set_options(options) end FFIGeos.GEOSGeoJSONWriter_writeGeometry_r(Geos.current_handle_pointer, ptr, geom.ptr, indentation) ensure set_options(old_options) unless options.nil? end