# File lib/0xffffff.rb, line 17 def initialize(path) @path = Pathname(path) end
# File lib/0xffffff.rb, line 21 def count_up count = read yield count count += 1 write(count) end
# File lib/0xffffff.rb, line 32 def read if @path.exist? @path.read.chomp.to_i else 0 end end
# File lib/0xffffff.rb, line 40 def write(count) open(@path, 'w') do |f| f.write count.to_s end end