Class: VagrantPlugins::Fsevents::Alerter
- Inherits:
-
Object
- Object
- VagrantPlugins::Fsevents::Alerter
- Defined in:
- lib/vagrant-fsevents/alerter.rb
Overview
Place to store messages that will be seen by the user
Instance Method Summary collapse
- #events(change_events) ⇒ Object
- #make_event_change_string(change_event) ⇒ Object
-
#watching(machine, rel_path) ⇒ Object
Alert the user to a successful folder watch start.
Instance Method Details
#events(change_events) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/vagrant-fsevents/alerter.rb', line 18 def events(change_events) return if change_events.empty? alert_lines = change_events.map do |change_event| make_event_change_string(change_event) end alert = alert_lines.join("\n") change_events[0].watch[:machine].ui.info(alert) end |
#make_event_change_string(change_event) ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/vagrant-fsevents/alerter.rb', line 10 def make_event_change_string(change_event) word = 'Changed' if change_event.type == :modified word = 'Added' if change_event.type == :added word = 'Removed' if change_event.type == :removed "fsevents: #{word}: #{change_event.relative_path}" end |
#watching(machine, rel_path) ⇒ Object
Alert the user to a successful folder watch start
6 7 8 |
# File 'lib/vagrant-fsevents/alerter.rb', line 6 def watching(machine, rel_path) machine.ui.info("fsevents: Watching #{rel_path}") end |