Class: ArchitectureJS::Watcher
- Inherits:
-
Object
- Object
- ArchitectureJS::Watcher
- Defined in:
- lib/architecture-js/watcher.rb
Instance Attribute Summary collapse
-
#listener ⇒ Object
Returns the value of attribute listener.
-
#project ⇒ Object
Returns the value of attribute project.
Instance Method Summary collapse
-
#initialize(project) ⇒ Watcher
constructor
A new instance of Watcher.
- #stop ⇒ Object
- #watch(message = false) ⇒ Object
Constructor Details
#initialize(project) ⇒ Watcher
Returns a new instance of Watcher.
6 7 8 9 10 11 12 13 14 |
# File 'lib/architecture-js/watcher.rb', line 6 def initialize(project) @project = project @listener = Listen.to(@project.root) do |modified, added, removed| update_files(modified, "modified") if modified.length > 0 update_files(added, "added") if added.length > 0 update_files(removed, "deleted") if removed.length > 0 end @listener.ignore(/#{@project.config[:build_dir]}/) end |
Instance Attribute Details
#listener ⇒ Object
Returns the value of attribute listener.
4 5 6 |
# File 'lib/architecture-js/watcher.rb', line 4 def listener @listener end |
#project ⇒ Object
Returns the value of attribute project.
4 5 6 |
# File 'lib/architecture-js/watcher.rb', line 4 def project @project end |
Instance Method Details
#stop ⇒ Object
22 23 24 |
# File 'lib/architecture-js/watcher.rb', line 22 def stop @listener.stop end |
#watch(message = false) ⇒ Object
16 17 18 19 20 |
# File 'lib/architecture-js/watcher.rb', line 16 def watch( = false) @listener.start puts ArchitectureJS::Notification.log if self end |