Class: BatchJaroWinkler::RuntimeModel

Inherits:
Object
  • Object
show all
Defined in:
lib/batch_jaro_winkler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(exportable_model) ⇒ RuntimeModel

Returns a new instance of RuntimeModel.



55
56
57
58
59
60
61
62
63
# File 'lib/batch_jaro_winkler.rb', line 55

def initialize(exportable_model)
   # We keep a reference because we use the candidates strings in the runtime model and
  # so we must guarantee that the exportable model is not garbage collected before the runtime model.
  @exportable_model = exportable_model
  @model = BatchJaroWinkler.bjw_build_runtime_model(exportable_model)
  raise 'batch_jaro_winkler.build_runtime_model failed' if @model.nil?
  # Makes a call to bjw_free_runtime_model when the runtime model is GC'd
  @_gced_model = FFI::AutoPointer.new(@model, BatchJaroWinkler.method(:bjw_free_runtime_model))
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



53
54
55
# File 'lib/batch_jaro_winkler.rb', line 53

def model
  @model
end