Class: RBWatch::FileScanner::ChangeSet
- Inherits:
-
Struct
- Object
- Struct
- RBWatch::FileScanner::ChangeSet
- Defined in:
- lib/rbwatch/file_scanner.rb
Instance Attribute Summary collapse
-
#added_paths ⇒ Object
Returns the value of attribute added_paths.
-
#modified_paths ⇒ Object
Returns the value of attribute modified_paths.
-
#removed_paths ⇒ Object
Returns the value of attribute removed_paths.
Instance Method Summary collapse
- #changed? ⇒ Boolean
-
#initialize(**kwargs) ⇒ ChangeSet
constructor
A new instance of ChangeSet.
- #paths ⇒ Object
- #total ⇒ Object
Constructor Details
#initialize(**kwargs) ⇒ ChangeSet
Returns a new instance of ChangeSet.
8 9 10 11 12 13 |
# File 'lib/rbwatch/file_scanner.rb', line 8 def initialize(**kwargs) super self.added_paths ||= [] self.removed_paths ||= [] self.modified_paths ||= [] end |
Instance Attribute Details
#added_paths ⇒ Object
Returns the value of attribute added_paths
7 8 9 |
# File 'lib/rbwatch/file_scanner.rb', line 7 def added_paths @added_paths end |
#modified_paths ⇒ Object
Returns the value of attribute modified_paths
7 8 9 |
# File 'lib/rbwatch/file_scanner.rb', line 7 def modified_paths @modified_paths end |
#removed_paths ⇒ Object
Returns the value of attribute removed_paths
7 8 9 |
# File 'lib/rbwatch/file_scanner.rb', line 7 def removed_paths @removed_paths end |
Instance Method Details
#changed? ⇒ Boolean
15 16 17 |
# File 'lib/rbwatch/file_scanner.rb', line 15 def changed? added_paths.any? || removed_paths.any? || modified_paths.any? end |
#paths ⇒ Object
23 24 25 |
# File 'lib/rbwatch/file_scanner.rb', line 23 def paths (added_paths + removed_paths + modified_paths).uniq end |
#total ⇒ Object
19 20 21 |
# File 'lib/rbwatch/file_scanner.rb', line 19 def total added_paths.length + removed_paths.length + modified_paths.length end |