Class: VinaryTree::Libdictenstein::PersistentArtrie

Inherits:
Dictionary
  • Object
show all
Defined in:
lib/vinary_tree/libdictenstein.rb

Instance Attribute Summary

Attributes inherited from Dictionary

#handle

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Dictionary

#capabilities, #close, #each, #entries, #entry_stream, finalizer, #get, #get_u64, #include?, #include_u64?, #initialize, #keys, #kind, #length, #values, #with_resource

Constructor Details

This class inherits a constructor from VinaryTree::Libdictenstein::Dictionary

Class Method Details

.create(path, domain: UNICODE_SCALAR) ⇒ Object



441
# File 'lib/vinary_tree/libdictenstein.rb', line 441

def self.create(path, domain: UNICODE_SCALAR) = open_native(path, domain, true)

.open(path, domain: UNICODE_SCALAR) ⇒ Object



442
# File 'lib/vinary_tree/libdictenstein.rb', line 442

def self.open(path, domain: UNICODE_SCALAR) = open_native(path, domain, false)

.open_native(path, domain, create) ⇒ Object



443
444
445
446
447
# File 'lib/vinary_tree/libdictenstein.rb', line 443

def self.open_native(path, domain, create)
  text = File.expand_path(path).b; output = Native.pointer_output
  function = create ? :ldict_persistent_artrie_create : :ldict_persistent_artrie_open
  Libdictenstein.check(Native.public_send(function, domain, text, text.bytesize, output)); new(Native.read_pointer(output))
end

Instance Method Details

#checkpointObject



452
# File 'lib/vinary_tree/libdictenstein.rb', line 452

def checkpoint = @handle.with_pointer { |pointer| Libdictenstein.check(Native.ldict_dictionary_checkpoint(pointer)) }

#put(term, value = nil) ⇒ Object



448
# File 'lib/vinary_tree/libdictenstein.rb', line 448

def put(term, value = nil) = put_text(term, value)

#put_u64(tokens, value = nil) ⇒ Object



450
# File 'lib/vinary_tree/libdictenstein.rb', line 450

def put_u64(tokens, value = nil) = put_tokens(tokens, value)

#remove(term) ⇒ Object



449
# File 'lib/vinary_tree/libdictenstein.rb', line 449

def remove(term) = remove_text(term)

#remove_u64(tokens) ⇒ Object



451
# File 'lib/vinary_tree/libdictenstein.rb', line 451

def remove_u64(tokens) = remove_tokens(tokens)