Class: Geos::Handle

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeHandle

Returns a new instance of Handle.



977
978
979
980
981
982
983
984
985
986
# File 'lib/ffi-geos.rb', line 977

def initialize
  @ptr = FFIGeos.initGEOS_r(
    @notice_handler = self.method(:notice_handler),
    @error_handler = self.method(:error_handler)
  )

  Kernel.at_exit {
    FFIGeos.finishGEOS_r(@ptr)
  }
end

Instance Attribute Details

#ptrObject (readonly)

Returns the value of attribute ptr.



975
976
977
# File 'lib/ffi-geos.rb', line 975

def ptr
  @ptr
end

Instance Method Details

#error_handler(*args) ⇒ Object

Raises:

  • (RuntimeError)


992
993
994
# File 'lib/ffi-geos.rb', line 992

def error_handler(*args)
  raise RuntimeError.new(args[0] % args[1])
end

#notice_handler(*args) ⇒ Object



988
989
990
# File 'lib/ffi-geos.rb', line 988

def notice_handler(*args)
  # no-op, just to appease initGEOS.
end