module TesseractFFI::ConfVars

module ConfVars

Public Instance Methods

get_double_variable(var_name) click to toggle source
# File lib/tesseract_ffi/conf_vars.rb, line 6
def get_double_variable(var_name)
  d_ptr = TesseractFFI::FFIDoublePtr.new

  unless tess_get_double_variable(@handle, var_name, d_ptr)
    raise TessException.new(error_msg: 'Unable to get config variable ' + var_name)
  end

  d_ptr[:value]
end
get_integer_variable(var_name) click to toggle source
# File lib/tesseract_ffi/conf_vars.rb, line 16
def get_integer_variable(var_name)
  i_ptr = TesseractFFI::FFIIntPtr.new

  unless tess_get_int_variable(@handle, var_name, i_ptr)
    raise TessException.new(error_msg: 'Unable to get config variable ' + var_name)
  end

  i_ptr[:value]
end
print_variables_to_file(file_name) click to toggle source
set_variable(var_name, value) click to toggle source
# File lib/tesseract_ffi/conf_vars.rb, line 26
def set_variable(var_name, value)
  mem_ptr = FFI::MemoryPointer.from_string(value.to_s)
  unless tess_set_variable(@handle, var_name, mem_ptr)
    raise TessException.new(error_msg: 'Unable to set config variable ' + var_name)
  end

  true
end