Class: Watch

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

Instance Method Summary collapse

Constructor Details

#initialize(glob, prefire: true, wait: 0.5, &block) ⇒ Watch

Returns a new instance of Watch.



2
3
4
5
6
7
8
9
10
11
12
13
# File 'lib/watch.rb', line 2

def initialize(glob, prefire: true, wait: 0.5, &block)
  raise "must pass a block" unless block_given?

  @glob = glob
  @wait = wait
  @block = block

  snapshot!
  @block.call if prefire

  run_loop
end