Class: RTesseract::Configuration

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

Overview

Configuration class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



19
20
21
# File 'lib/rtesseract/configuration.rb', line 19

def initialize
  @processor = 'rmagick'
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



17
18
19
# File 'lib/rtesseract/configuration.rb', line 17

def command
  @command
end

#debugObject

Returns the value of attribute debug.



17
18
19
# File 'lib/rtesseract/configuration.rb', line 17

def debug
  @debug
end

#langObject

Returns the value of attribute lang.



17
18
19
# File 'lib/rtesseract/configuration.rb', line 17

def lang
  @lang
end

#oemObject

Returns the value of attribute oem.



17
18
19
# File 'lib/rtesseract/configuration.rb', line 17

def oem
  @oem
end

#options_cmdObject

Returns the value of attribute options_cmd.



17
18
19
# File 'lib/rtesseract/configuration.rb', line 17

def options_cmd
  @options_cmd
end

#processorObject

Returns the value of attribute processor.



17
18
19
# File 'lib/rtesseract/configuration.rb', line 17

def processor
  @processor
end

#psmObject

Returns the value of attribute psm.



17
18
19
# File 'lib/rtesseract/configuration.rb', line 17

def psm
  @psm
end

#tessdata_dirObject

Returns the value of attribute tessdata_dir.



17
18
19
# File 'lib/rtesseract/configuration.rb', line 17

def tessdata_dir
  @tessdata_dir
end

#user_patternsObject

Returns the value of attribute user_patterns.



17
18
19
# File 'lib/rtesseract/configuration.rb', line 17

def user_patterns
  @user_patterns
end

#user_wordsObject

Returns the value of attribute user_words.



17
18
19
# File 'lib/rtesseract/configuration.rb', line 17

def user_words
  @user_words
end

Instance Method Details

#load_options(options, names = []) ⇒ Object

Return the values of options



34
35
36
# File 'lib/rtesseract/configuration.rb', line 34

def load_options(options, names = [])
  names.each { |name| option(options, name, nil) }
end

#option(options, name, default = nil) ⇒ Object

Set value of option



29
30
31
# File 'lib/rtesseract/configuration.rb', line 29

def option(options, name, default = nil)
  self.instance_variable_set("@#{name}", options.option(name, parent.send(name)) || default)
end

#parentObject

Global configuration



24
25
26
# File 'lib/rtesseract/configuration.rb', line 24

def parent
  @parent ||= RTesseract.configuration || RTesseract::Configuration.new
end