Class: Geos::GeoJSONWriter
- Inherits:
-
Object
- Object
- Geos::GeoJSONWriter
- Defined in:
- lib/ffi-geos/geojson_writer.rb
Instance Attribute Summary collapse
-
#indentation ⇒ Object
Returns the value of attribute indentation.
-
#ptr ⇒ Object
readonly
Returns the value of attribute ptr.
Class Method Summary collapse
-
.release(ptr) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ GeoJSONWriter
constructor
A new instance of GeoJSONWriter.
-
#write(geom, options = nil) ⇒ Object
Options can be set temporarily for individual writes using an options Hash.
Constructor Details
#initialize(options = {}) ⇒ GeoJSONWriter
Returns a new instance of GeoJSONWriter.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/ffi-geos/geojson_writer.rb', line 8 def initialize( = {}) = { indentation: -1 }.merge() ptr = FFIGeos.GEOSGeoJSONWriter_create_r(Geos.current_handle_pointer) @ptr = FFI::AutoPointer.new( ptr, self.class.method(:release) ) () end |
Instance Attribute Details
#indentation ⇒ Object
Returns the value of attribute indentation.
5 6 7 |
# File 'lib/ffi-geos/geojson_writer.rb', line 5 def indentation @indentation end |
#ptr ⇒ Object (readonly)
Returns the value of attribute ptr.
6 7 8 |
# File 'lib/ffi-geos/geojson_writer.rb', line 6 def ptr @ptr end |
Class Method Details
.release(ptr) ⇒ Object
:nodoc:
22 23 24 |
# File 'lib/ffi-geos/geojson_writer.rb', line 22 def self.release(ptr) # :nodoc: FFIGeos.GEOSGeoJSONWriter_destroy_r(Geos.current_handle_pointer, ptr) end |
Instance Method Details
#write(geom, options = nil) ⇒ Object
Options can be set temporarily for individual writes using an options Hash. Options include :indentation.
35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/ffi-geos/geojson_writer.rb', line 35 def write(geom, = nil) unless .nil? = { indentation: indentation } () end FFIGeos.GEOSGeoJSONWriter_writeGeometry_r(Geos.current_handle_pointer, ptr, geom.ptr, indentation) ensure () unless .nil? end |