increment 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/increment.rb +1 -1
- metadata +1 -1
data/lib/increment.rb
CHANGED
@@ -7,7 +7,7 @@ class Increment
|
|
7
7
|
def self.update(file='counter.txt')
|
8
8
|
|
9
9
|
if File.exists? file then
|
10
|
-
File.open(
|
10
|
+
File.open(file, 'r+'){|f| i = f.read.succ; f.rewind; f.write i}
|
11
11
|
else
|
12
12
|
File.open(file,'w'){|f| f.write '1'}
|
13
13
|
end
|