rtesseract 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f448efba206c34ef3b724c94cef32431e204c63d
4
- data.tar.gz: e5dc7a8774b74c1905f173cc865ccca2529a9ec6
3
+ metadata.gz: 306d7190055e16449e318de2ab9646835ec1114c
4
+ data.tar.gz: b4309c8765de4c99bb436e08ba5cb50bb2aae5e4
5
5
  SHA512:
6
- metadata.gz: 2e946b231c93e453fe65464dfbd1ca2a460494fc4b07aefcfab0bc16eac7ad2f95ab23079af3b1c6a710c726704a5e8e3d9511fc7877736b96f26b5d52113772
7
- data.tar.gz: 04b78ea1c989450a88d1b336c8981d9ee50c7520f96b4faa3593f3246acae8fa54a2fbe6768070f5e331b608e62c0e32e6cb8cf78051b363898a25d0176472dd
6
+ metadata.gz: 1c0f98a7afa037b33dc5231194554cb428c0e05098a1d623556a601eb44b363c95fa91eaa98fd4086921108144f118d3526c5413790e3c7fd090bc671430109c
7
+ data.tar.gz: 043e45b5c0079c4d56ee8b9f34c3a76fb6698eb5c993d87865774a0f1c80cebb7ada2c34580c9e22218be9a420a3c25d82cd94ee18ddfc986fd29c99e2aa006a
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.4
1
+ 1.0.5
data/lib/rtesseract.rb CHANGED
@@ -69,10 +69,14 @@ class RTesseract
69
69
 
70
70
  #Remove files
71
71
  def remove_file(files=[])
72
- files.each do |file|
73
- file.close
74
- file.unlink
75
- end
72
+ files.each do |file|
73
+ if file.is_a?(Tempfile)
74
+ file.close
75
+ file.unlink
76
+ else
77
+ File.unlink(file)
78
+ end
79
+ end
76
80
  true
77
81
  rescue
78
82
  raise RTesseract::TempFilesNotRemovedError
@@ -134,11 +138,11 @@ class RTesseract
134
138
 
135
139
  #Convert image to string
136
140
  def convert
137
- path = Tempfile.new(["",".txt"]).path.to_s
141
+ path = Pathname.new(Dir::tmpdir).join("#{Time.now.to_f}#{rand(1500)}.txt").to_s
138
142
  tmp_image = image_to_tiff
139
143
  `#{@command} "#{tmp_image.path}" "#{path.gsub(".txt","")}" #{lang} #{psm} #{config_file} #{clear_console_output}`
140
- @value = File.read("#{path}").to_s
141
- remove_file([tmp_image])
144
+ @value = File.read(path).to_s
145
+ remove_file([tmp_image, path])
142
146
  rescue
143
147
  raise RTesseract::ConversionError
144
148
  end
data/rtesseract.gemspec CHANGED
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: rtesseract 1.0.5 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "rtesseract"
8
- s.version = "1.0.4"
9
+ s.version = "1.0.5"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Danilo Jeremias da Silva"]
12
- s.date = "2014-01-15"
14
+ s.date = "2014-01-21"
13
15
  s.description = "Ruby library for working with the Tesseract OCR."
14
16
  s.email = "dannnylo@gmail.com"
15
17
  s.extra_rdoc_files = [
@@ -45,8 +47,7 @@ Gem::Specification.new do |s|
45
47
  ]
46
48
  s.homepage = "http://github.com/dannnylo/rtesseract"
47
49
  s.licenses = ["MIT"]
48
- s.require_paths = ["lib"]
49
- s.rubygems_version = "2.0.3"
50
+ s.rubygems_version = "2.2.0"
50
51
  s.summary = "Ruby library for working with the Tesseract OCR."
51
52
 
52
53
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rtesseract
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danilo Jeremias da Silva
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-15 00:00:00.000000000 Z
11
+ date: 2014-01-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -147,7 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
147
147
  version: '0'
148
148
  requirements: []
149
149
  rubyforge_project:
150
- rubygems_version: 2.0.3
150
+ rubygems_version: 2.2.0
151
151
  signing_key:
152
152
  specification_version: 4
153
153
  summary: Ruby library for working with the Tesseract OCR.