Class: FFFFFF::Counter

Inherits:
Object
  • Object
show all
Defined in:
lib/0xffffff.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Counter

Returns a new instance of Counter.



17
18
19
# File 'lib/0xffffff.rb', line 17

def initialize(path)
  @path = Pathname(path)
end

Instance Method Details

#count_up {|count| ... } ⇒ Object

Yields:

  • (count)


21
22
23
24
25
26
27
28
# File 'lib/0xffffff.rb', line 21

def count_up
  count = read

  yield count

  count += 1
  write(count)
end