Class: Geos::Handle

Inherits:
Object
  • Object
show all
Defined in:
lib/ffi-geos.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHandle

Deprecated initialization and teardown…



1137
1138
1139
1140
1141
1142
# File 'lib/ffi-geos.rb', line 1137

def initialize
  @ptr = FFI::AutoPointer.new(FFIGeos.GEOS_init_r, self.class.method(:release))

  reset_notice_handler
  reset_error_handler
end

Instance Attribute Details

#ptrObject (readonly)

Returns the value of attribute ptr.



1091
1092
1093
# File 'lib/ffi-geos.rb', line 1091

def ptr
  @ptr
end

Class Method Details

.release(ptr) ⇒ Object



1101
1102
1103
# File 'lib/ffi-geos.rb', line 1101

def self.release(ptr)
  FFIGeos.GEOS_finish_r(ptr)
end

Instance Method Details

#error_handlerObject



1122
1123
1124
1125
# File 'lib/ffi-geos.rb', line 1122

def error_handler(&block)
  self.error_handler = block if block_given?
  @error_handler
end

#error_handler=(method_or_block) ⇒ Object



1111
1112
1113
1114
1115
# File 'lib/ffi-geos.rb', line 1111

def error_handler=(method_or_block)
  @error_handler = method_or_block
  FFIGeos.GEOSContext_setErrorMessageHandler_r(@ptr, @error_handler, nil)
  @error_handler
end

#notice_handlerObject



1117
1118
1119
1120
# File 'lib/ffi-geos.rb', line 1117

def notice_handler(&block)
  self.notice_handler = block if block_given?
  @notice_handler
end

#notice_handler=(method_or_block) ⇒ Object



1105
1106
1107
1108
1109
# File 'lib/ffi-geos.rb', line 1105

def notice_handler=(method_or_block)
  @notice_handler = method_or_block
  FFIGeos.GEOSContext_setNoticeMessageHandler_r(@ptr, @notice_handler, nil)
  @notice_handler
end

#reset_error_handlerObject



1131
1132
1133
# File 'lib/ffi-geos.rb', line 1131

def reset_error_handler
  self.error_handler = method(:default_error_handler)
end

#reset_notice_handlerObject



1127
1128
1129
# File 'lib/ffi-geos.rb', line 1127

def reset_notice_handler
  self.notice_handler = method(:default_notice_handler)
end