Sha256: 182f915ee40fbb49827e86ca645988aaf85ee0694474526bf3f06ae0a707de97
Contents?: true
Size: 980 Bytes
Versions: 1
Compression:
Stored size: 980 Bytes
Contents
require 'open3' # RTesseract class RTesseract # Some utils methods module Utils # Remove files or Tempfile def self.remove_files(files = []) files.each do |file| self.remove_file(file) end true rescue => error raise RTesseract::TempFilesNotRemovedError.new(error: error, files: files) end # Remove file or Tempfile def self.remove_file(file) if file.is_a?(Tempfile) file.close file.unlink else File.unlink(file) end true end # Extract tesseract version number def self.version_number out, err, st = Open3.capture3(RTesseract.default_command, "--version") version = err.split("\n")[0].split(" ")[1].split('.')[0, 2].join('.') Float(version) rescue nil end end end # Hash class Hash # return the value and remove from hash def option(attr_name, default) delete(attr_name.to_s) || delete(attr_name) || default end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rtesseract-2.1.0 | lib/rtesseract/utils.rb |