lib/scrambled_jpeg.rb in scrambled_jpeg-0.1.5 vs lib/scrambled_jpeg.rb in scrambled_jpeg-0.1.6
- old
+ new
@@ -1,14 +1,18 @@
require 'scrambled_jpeg/version'
module ScrambledJpeg
class << self
- def scramble filename, grain
+ def scramble filename, grain=5
ending, cache = (store = File.readlines filename).pop, []
(new_file = File.open Time.now.hash.to_s + '.jpg', "w").write store.shift
- (grain || 5).times { new_file.write store.shift }
+ grain.times { new_file.write store.shift }
.times { cache << store.shift }
.times { new_file.write store.shift }
.times { new_file.write cache.shift } until store.empty? && cache.empty?
new_file.write ending && new_file.close
+ end
+
+ def hardboil filename, times=1
+
end
end
end