bin/pdf2ruby in origami-1.2.3 vs bin/pdf2ruby in origami-1.2.4
- old
+ new
@@ -24,15 +24,15 @@
Guillaume Delugré
=end
require 'optparse'
-require 'ftools'
+require 'fileutils'
begin
+ ORIGAMIDIR = "#{File.dirname(__FILE__)}/../lib"
require 'origami'
rescue LoadError
- ORIGAMIDIR = "#{File.dirname(__FILE__)}/../lib"
$: << ORIGAMIDIR
require 'origami'
end
include Origami
@@ -313,10 +313,14 @@
Console.colorprint "[*] ", Console::Colors::RED
puts "Processing the object hierarchy..."
@current_idx = 0
while @current_idx != @obj_route.size
varname = @obj_route[@current_idx]
- obj = target[@var_hash.index(varname)]
+ if RUBY_VERSION < '1.9'
+ obj = target[@var_hash.index(varname)]
+ else
+ obj = target[@var_hash.key(varname)]
+ end
@code_hash[varname] ||= {}
@code_hash[varname][:body] = objectToRuby(obj, 0, varname, true)
@current_idx = @current_idx + 1