class Core::Watch::Diff
- public
-
Contains changes to a watched system, organized by operation.
Constants
- OPERATIONS
Public Class Methods
new()
click to toggle source
# File lib/core/watch/diff.rb, line 15 def initialize @changes = {} end
Public Instance Methods
changed?()
click to toggle source
- public
-
Return `true` if the diff contains changes.
# File lib/core/watch/diff.rb, line 47 def changed? @changes.any? end
each_change(&block)
click to toggle source
- public
-
Call the given block once with each changed path and operation.
# File lib/core/watch/diff.rb, line 31 def each_change(&block) return to_enum(:each_change) unless block @changes.each_pair(&block) end
each_changed_path(&block)
click to toggle source
- public
-
Call the given block once with each changed path.
# File lib/core/watch/diff.rb, line 39 def each_changed_path(&block) return to_enum(:each_changed_path) unless block @changes.each_key(&block) end
include?(path)
click to toggle source
- public
-
Return `true` if `path` is included in the changes.
# File lib/core/watch/diff.rb, line 53 def include?(path) @changes.include?(Pathname(path)) end
operation(path)
click to toggle source
- public
-
Return the operation for the given path.
# File lib/core/watch/diff.rb, line 59 def operation(path) @changes[path] end