Class: VagrantPlugins::Fsevents::ChangeEvents
- Inherits:
-
Object
- Object
- VagrantPlugins::Fsevents::ChangeEvents
- Defined in:
- lib/vagrant-fsevents/changeEvents.rb
Overview
A single changed path string of a specified change type
Instance Attribute Summary collapse
-
#full_path_on_guest ⇒ Object
readonly
Returns the value of attribute full_path_on_guest.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#relative_path ⇒ Object
readonly
Returns the value of attribute relative_path.
-
#sync_path ⇒ Object
readonly
Returns the value of attribute sync_path.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#watch ⇒ Object
readonly
Returns the value of attribute watch.
-
#watch_path ⇒ Object
readonly
Returns the value of attribute watch_path.
Class Method Summary collapse
-
.make(mods, adds, removes, watch) ⇒ Object
Takes the output of a listen callback (as arrays of strings of files split by type of change) and converts them into single events for a specific watch definition.
Instance Method Summary collapse
-
#initialize(path, type, watch) ⇒ ChangeEvents
constructor
A new instance of ChangeEvents.
Constructor Details
#initialize(path, type, watch) ⇒ ChangeEvents
Returns a new instance of ChangeEvents.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/vagrant-fsevents/changeEvents.rb', line 29 def initialize(path, type, watch) @path = path @type = type @sync_path = watch[:sync_path] @watch_path = watch[:watch_path] @watch = watch @relative_path = path.sub(sync_path, '') @full_path_on_guest = File.join( (watch[:opts][:override_guestpath] || watch[:opts][:guestpath]), @relative_path ) end |
Instance Attribute Details
#full_path_on_guest ⇒ Object (readonly)
Returns the value of attribute full_path_on_guest.
13 14 15 |
# File 'lib/vagrant-fsevents/changeEvents.rb', line 13 def full_path_on_guest @full_path_on_guest end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
7 8 9 |
# File 'lib/vagrant-fsevents/changeEvents.rb', line 7 def path @path end |
#relative_path ⇒ Object (readonly)
Returns the value of attribute relative_path.
12 13 14 |
# File 'lib/vagrant-fsevents/changeEvents.rb', line 12 def relative_path @relative_path end |
#sync_path ⇒ Object (readonly)
Returns the value of attribute sync_path.
10 11 12 |
# File 'lib/vagrant-fsevents/changeEvents.rb', line 10 def sync_path @sync_path end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
8 9 10 |
# File 'lib/vagrant-fsevents/changeEvents.rb', line 8 def type @type end |
#watch ⇒ Object (readonly)
Returns the value of attribute watch.
9 10 11 |
# File 'lib/vagrant-fsevents/changeEvents.rb', line 9 def watch @watch end |
#watch_path ⇒ Object (readonly)
Returns the value of attribute watch_path.
11 12 13 |
# File 'lib/vagrant-fsevents/changeEvents.rb', line 11 def watch_path @watch_path end |
Class Method Details
.make(mods, adds, removes, watch) ⇒ Object
Takes the output of a listen callback (as arrays of strings of files split by type of change) and converts them into single events for a specific watch definition
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/vagrant-fsevents/changeEvents.rb', line 18 def self.make(mods, adds, removes, watch) change_events = [] structure = { modified: mods, added: adds, removed: removes } structure.each do |type, files| files.each do |path| change_events.push new(path, type, watch) end end change_events end |