lib/keepassx.rb in ruby-keepassx-0.2.0 vs lib/keepassx.rb in ruby-keepassx-0.2.1
- old
+ new
@@ -3,9 +3,28 @@
require 'openssl'
require 'digest/sha2'
require 'securerandom'
require 'rexml/document'
+# Add backward compatibility stuff
+if RUBY_VERSION =~ /1\.8/
+ require 'backports/tools'
+ require 'backports/1.9.1/symbol/empty'
+ require 'backports/1.9.3/io/write'
+ require 'time' # Get Time.parse
+
+ unless SecureRandom.method_defined? :uuid
+ module SecureRandom
+ # Based on this post https://www.ruby-forum.com/topic/3171049#1035902
+ def self.uuid
+ s = hex 16
+ [s[0..7], s[8..11], s[12..15], s[16..19], s[20..-1]].join '-'
+ end
+ end
+ end
+end
+
+
require 'keepassx/exceptions'
require 'keepassx/header'
require 'keepassx/utilities'
require 'keepassx/database'
require 'keepassx/field'