pdftk 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README.md +2 -3
  2. data/lib/pdftk.rb +6 -5
  3. metadata +3 -3
data/README.md CHANGED
@@ -5,7 +5,7 @@ Pdftk is gem for merging pdf files with pdftk library for Rails.
5
5
 
6
6
  ### Installation
7
7
 
8
- Configure it in an initializer:
8
+ Configure it in an initializer:
9
9
  Pdftk.config = {
10
10
  :exe_path => '/usr/local/bin/pdftk'
11
11
  }
@@ -23,6 +23,5 @@ or add this to your Gemfile:
23
23
 
24
24
  Is a example of usage:
25
25
 
26
- pdftk = Pdftk.new(array_with_files_path_to_merging, output_file)
27
- result = pdftk.merge
26
+ pdf = Pdftk.new.merge(array_with_files_path_to_merging, output_file_path)
28
27
 
data/lib/pdftk.rb CHANGED
@@ -15,16 +15,17 @@ class Pdftk
15
15
  @@config = {}
16
16
  cattr_accessor :config
17
17
 
18
- def initialize(source_array, destination_path)
19
- @exe_path = find_binary_path
20
- @source_files = source_array
21
- @merged_file_path = destination_path
18
+ def initialize(execute_path = nil)
19
+ @exe_path = execute_path || find_binary_path
22
20
  raise "Location of #{EXE_PATH} unknow" if @exe_path.empty?
23
21
  raise "Bad location of #{EXE_PATH}'s path" unless File.exists?(@exe_path)
24
22
  raise "#{EXE_PATH} is not executable" unless File.executable?(@exe_path)
25
23
  end
26
24
 
27
- def merge
25
+ def merge(source_array, destination_path)
26
+ @source_files = source_array
27
+ @merged_file_path = destination_path
28
+
28
29
  command = "#{@exe_path} #{@source_files.join(' ')} cat output #{@merged_file_path}"
29
30
  err = Open3.popen3(command) do |stdin, stdout, stderr|
30
31
  stderr.read
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pdftk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Konrad Glowacki