Class: Space::Source::Watch

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

Constant Summary collapse

LATENCY =
0.1
NO_DEFER =
FALSE

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, &block) ⇒ Watch

Returns a new instance of Watch.



11
12
13
14
15
# File 'lib/space/source/watch.rb', line 11

def initialize(path, &block)
  @path = File.expand_path(path)
  @callback = block
  @fsevent = FSEvent.new
end

Instance Attribute Details

#callbackObject (readonly)

Returns the value of attribute callback.



9
10
11
# File 'lib/space/source/watch.rb', line 9

def callback
  @callback
end

#fseventObject (readonly)

Returns the value of attribute fsevent.



9
10
11
# File 'lib/space/source/watch.rb', line 9

def fsevent
  @fsevent
end

#pathObject (readonly)

Returns the value of attribute path.



9
10
11
# File 'lib/space/source/watch.rb', line 9

def path
  @path
end

Instance Method Details

#runObject



17
18
19
20
21
22
23
# File 'lib/space/source/watch.rb', line 17

def run
  @thread = Thread.new do
    log "WATCHING #{path}"
    watch
  end
  self
end