Class: Geos::Handle
- Inherits:
-
Object
- Object
- Geos::Handle
- Defined in:
- lib/ffi-geos.rb
Instance Attribute Summary collapse
-
#ptr ⇒ Object
readonly
Returns the value of attribute ptr.
Class Method Summary collapse
Instance Method Summary collapse
- #error_handler(*args) ⇒ Object
-
#initialize ⇒ Handle
constructor
A new instance of Handle.
- #notice_handler(*args) ⇒ Object
Constructor Details
#initialize ⇒ Handle
Returns a new instance of Handle.
1007 1008 1009 1010 1011 1012 1013 1014 1015 |
# File 'lib/ffi-geos.rb', line 1007 def initialize @ptr = FFI::AutoPointer.new( FFIGeos.initGEOS_r( @notice_handler = self.method(:notice_handler), @error_handler = self.method(:error_handler) ), self.class.method(:release) ) end |
Instance Attribute Details
#ptr ⇒ Object (readonly)
Returns the value of attribute ptr.
1005 1006 1007 |
# File 'lib/ffi-geos.rb', line 1005 def ptr @ptr end |
Class Method Details
.release(ptr) ⇒ Object
1017 1018 1019 |
# File 'lib/ffi-geos.rb', line 1017 def self.release(ptr) FFIGeos.finishGEOS_r(ptr) end |
Instance Method Details
#error_handler(*args) ⇒ Object
1025 1026 1027 |
# File 'lib/ffi-geos.rb', line 1025 def error_handler(*args) raise RuntimeError.new(args[0] % args[1]) end |
#notice_handler(*args) ⇒ Object
1021 1022 1023 |
# File 'lib/ffi-geos.rb', line 1021 def notice_handler(*args) # no-op, just to appease initGEOS. end |