Class: Space::Shell::Watch

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

Constant Summary collapse

LATENCY =
0
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
16
# File 'lib/space/shell/watch.rb', line 11

def initialize(path, &block)
  @path = File.expand_path(path)
  @callback = block
  @mutex = Mutex.new
  self
end

Instance Attribute Details

#callbackObject (readonly)

Returns the value of attribute callback.



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

def callback
  @callback
end

#mutexObject (readonly)

Returns the value of attribute mutex.



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

def mutex
  @mutex
end

#pathObject (readonly)

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#runObject



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

def run
  Thread.new do
    App.logger.debug("WATCHING #{path}")
    watch
  end
end