Sha256: 66adbfa6b93ff1d1e0bbcc1623d9ee210b8622f95c0a0509f0fa94a715c4ec88
Contents?: true
Size: 976 Bytes
Versions: 1
Compression:
Stored size: 976 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 output, st = Open3.capture2e(RTesseract.default_command, "--version") version = output.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.2.0 | lib/rtesseract/utils.rb |