Class: BatchJaroWinkler::RuntimeModel
- Inherits:
-
Object
- Object
- BatchJaroWinkler::RuntimeModel
- Defined in:
- lib/batch_jaro_winkler.rb
Instance Attribute Summary collapse
-
#model ⇒ Object
readonly
Returns the value of attribute model.
Instance Method Summary collapse
-
#initialize(exportable_model) ⇒ RuntimeModel
constructor
A new instance of RuntimeModel.
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
#model ⇒ Object (readonly)
Returns the value of attribute model.
53 54 55 |
# File 'lib/batch_jaro_winkler.rb', line 53 def model @model end |