Class: VinaryTree::Libdictenstein::Scdawg

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

Instance Attribute Summary

Attributes inherited from Dictionary

#handle

Instance Method Summary collapse

Methods inherited from Dictionary

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

Constructor Details

#initialize(domain: UNICODE_SCALAR) ⇒ Scdawg

Returns a new instance of Scdawg.



428
429
430
# File 'lib/vinary_tree/libdictenstein.rb', line 428

def initialize(domain: UNICODE_SCALAR)
  output = Native.pointer_output; Libdictenstein.check(Native.ldict_scdawg_new(domain, output)); super(Native.read_pointer(output))
end

Instance Method Details

#include_substring?(term) ⇒ Boolean

Returns:

  • (Boolean)


432
433
434
# File 'lib/vinary_tree/libdictenstein.rb', line 432

def include_substring?(term)
  output = Native.byte_output; @handle.with_pointer { |pointer| Libdictenstein.check(Native.ldict_scdawg_contains_substring(pointer, term.b, term.bytesize, output)) }; output[0].positive?
end

#put(term, value = nil) ⇒ Object



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

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

#substring_frequency(term) ⇒ Object



435
436
437
# File 'lib/vinary_tree/libdictenstein.rb', line 435

def substring_frequency(term)
  output = Native.size_output; @handle.with_pointer { |pointer| Libdictenstein.check(Native.ldict_scdawg_substring_frequency(pointer, term.b, term.bytesize, output)) }; Native.read_size(output)
end