Class: OCR::Path
- Inherits:
-
Object
- Object
- OCR::Path
- Defined in:
- lib/simple-ocr/path.rb
Constant Summary collapse
- EXTENS =
{:pdf => "pdf", :png => "png"}
Instance Method Summary collapse
-
#clean_image_path ⇒ String
Clean your Input File.
-
#duplicate_path ⇒ String
Duplicate the input file path.
-
#get_filename ⇒ String
Get the FileName.
-
#image_path ⇒ String
From PDF to Image conversion.
-
#initialize(input_file) ⇒ Path
constructor
Initialize your Input File.
-
#name_exten ⇒ Array
Split the Realname.
Constructor Details
#initialize(input_file) ⇒ Path
Initialize your Input File.
9 10 11 |
# File 'lib/simple-ocr/path.rb', line 9 def initialize(input_file) @input_file = input_file end |
Instance Method Details
#clean_image_path ⇒ String
Clean your Input File
39 40 41 42 43 |
# File 'lib/simple-ocr/path.rb', line 39 def clean_image_path duppath = duplicate_path duppath[get_filename] = "cleaned_"+name_exten[0]+".png" return duppath end |
#duplicate_path ⇒ String
Duplicate the input file path
23 24 25 |
# File 'lib/simple-ocr/path.rb', line 23 def duplicate_path return @input_file.dup end |
#get_filename ⇒ String
Get the FileName
48 49 50 |
# File 'lib/simple-ocr/path.rb', line 48 def get_filename File.basename(@input_file).split("/")[0] end |
#image_path ⇒ String
From PDF to Image conversion
30 31 32 33 34 |
# File 'lib/simple-ocr/path.rb', line 30 def image_path duppath = duplicate_path duppath[name_exten[1]] = Path::EXTENS[:png] return duppath end |
#name_exten ⇒ Array
Split the Realname
16 17 18 |
# File 'lib/simple-ocr/path.rb', line 16 def name_exten File.basename(@input_file).split(".") end |