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…



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

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.



1079
1080
1081
# File 'lib/ffi-geos.rb', line 1079

def ptr
  @ptr
end

Class Method Details

.release(ptr) ⇒ Object



1089
1090
1091
# File 'lib/ffi-geos.rb', line 1089

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

Instance Method Details

#error_handlerObject



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

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

#error_handler=(method_or_block) ⇒ Object



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

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

#notice_handlerObject



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

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

#notice_handler=(method_or_block) ⇒ Object



1093
1094
1095
1096
1097
# File 'lib/ffi-geos.rb', line 1093

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



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

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

#reset_notice_handlerObject



1115
1116
1117
# File 'lib/ffi-geos.rb', line 1115

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