Module: TesseractFFI::ConfVars
- Included in:
- Tesseract
- Defined in:
- lib/tesseract_ffi/conf_vars.rb
Overview
module ConfVars
Instance Method Summary collapse
- #get_double_variable(var_name) ⇒ Object
- #get_integer_variable(var_name) ⇒ Object
- #print_variables_to_file(file_name) ⇒ Object
- #set_variable(var_name, value) ⇒ Object
Instance Method Details
#get_double_variable(var_name) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# 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) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# 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) ⇒ Object
35 36 37 38 39 40 |
# File 'lib/tesseract_ffi/conf_vars.rb', line 35 def print_variables_to_file(file_name) result = tess_print_to_file(@handle, file_name) raise TessException.new(error_msg: 'Unable to print variables to ' + file_name) unless result result end |
#set_variable(var_name, value) ⇒ Object
26 27 28 29 30 31 32 33 |
# 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 |