Module: H3::Bindings::Base
- Included in:
- Private, Hierarchy, Indexing, Inspection, Miscellaneous, Regions, Traversal, UnidirectionalEdges
- Defined in:
- lib/h3/bindings/base.rb
Overview
Base for FFI Bindings.
When extended, this module sets up FFI to use the H3 C library.
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/h3/bindings/base.rb', line 7 def self.extended(base) lib_path = File.(__dir__ + "/../../../ext/h3/src/lib") base.extend FFI::Library base.extend Gem::Deprecate base.include Structs base.include Types base.ffi_lib ["#{lib_path}/libh3.dylib", "#{lib_path}/libh3.so"] base.typedef :ulong_long, :h3_index base.typedef :int, :k_distance end |
Instance Method Details
#attach_predicate_function(name, *args) ⇒ Object
18 19 20 21 22 23 |
# File 'lib/h3/bindings/base.rb', line 18 def attach_predicate_function(name, *args) stripped_name = name.to_s.gsub("?", "") attach_function(stripped_name, *args).tap do rename_function stripped_name, name end end |