Class: Bashly::Watch
- Inherits:
-
Object
- Object
- Bashly::Watch
- Defined in:
- lib/bashly/watch.rb
Overview
File system watcher - an ergonomic wrapper around the Listen gem
Instance Attribute Summary collapse
-
#dirs ⇒ Object
readonly
Returns the value of attribute dirs.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(*dirs, **options) ⇒ Watch
constructor
A new instance of Watch.
- #on_change ⇒ Object
Constructor Details
#initialize(*dirs, **options) ⇒ Watch
Returns a new instance of Watch.
8 9 10 11 |
# File 'lib/bashly/watch.rb', line 8 def initialize(*dirs, **) @options = .merge().freeze @dirs = dirs.empty? ? ['.'] : dirs end |
Instance Attribute Details
#dirs ⇒ Object (readonly)
Returns the value of attribute dirs.
6 7 8 |
# File 'lib/bashly/watch.rb', line 6 def dirs @dirs end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/bashly/watch.rb', line 6 def @options end |
Instance Method Details
#on_change ⇒ Object
13 14 15 16 17 18 |
# File 'lib/bashly/watch.rb', line 13 def on_change(&) start(&) wait ensure stop end |