Class: Space::Source::Watch
- Inherits:
-
Object
- Object
- Space::Source::Watch
- Defined in:
- lib/space/source/watch.rb
Constant Summary collapse
- LATENCY =
0.1
- NO_DEFER =
FALSE
Instance Attribute Summary collapse
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#fsevent ⇒ Object
readonly
Returns the value of attribute fsevent.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#suspended ⇒ Object
readonly
Returns the value of attribute suspended.
Instance Method Summary collapse
-
#initialize(path, &block) ⇒ Watch
constructor
A new instance of Watch.
- #run ⇒ Object
Constructor Details
#initialize(path, &block) ⇒ Watch
Returns a new instance of Watch.
11 12 13 14 15 16 |
# File 'lib/space/source/watch.rb', line 11 def initialize(path, &block) @path = File.(path) @callback = block # @suspended = [] @fsevent = FSEvent.new end |
Instance Attribute Details
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
9 10 11 |
# File 'lib/space/source/watch.rb', line 9 def callback @callback end |
#fsevent ⇒ Object (readonly)
Returns the value of attribute fsevent.
9 10 11 |
# File 'lib/space/source/watch.rb', line 9 def fsevent @fsevent end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
9 10 11 |
# File 'lib/space/source/watch.rb', line 9 def path @path end |
#suspended ⇒ Object (readonly)
Returns the value of attribute suspended.
9 10 11 |
# File 'lib/space/source/watch.rb', line 9 def suspended @suspended end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/space/source/watch.rb', line 18 def run @thread = Thread.new do log "WATCHING #{path}" watch end self end |