Class: HatebuWatcher::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/hatebu_watcher/base.rb

Instance Method Summary collapse

Constructor Details

#initialize(url, interval) ⇒ Base

Returns a new instance of Base.



3
4
5
6
7
8
# File 'lib/hatebu_watcher/base.rb', line 3

def initialize(url, interval)
  @interval = interval

  @counter = Counter.new(url)
  @counter.add_observer(Observers::CounterObserver.new)
end

Instance Method Details

#watchObject



10
11
12
13
14
15
16
# File 'lib/hatebu_watcher/base.rb', line 10

def watch
  loop do
    puts @counter.reload.count

    sleep @interval
  end
end