Class: RBWatch::FileScanner::ChangeSet

Inherits:
Struct
  • Object
show all
Defined in:
lib/rbwatch/file_scanner.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_pathsObject

Returns the value of attribute added_paths

Returns:

  • (Object)

    the current value of added_paths



7
8
9
# File 'lib/rbwatch/file_scanner.rb', line 7

def added_paths
  @added_paths
end

#modified_pathsObject

Returns the value of attribute modified_paths

Returns:

  • (Object)

    the current value of modified_paths



7
8
9
# File 'lib/rbwatch/file_scanner.rb', line 7

def modified_paths
  @modified_paths
end

#removed_pathsObject

Returns the value of attribute removed_paths

Returns:

  • (Object)

    the current value of removed_paths



7
8
9
# File 'lib/rbwatch/file_scanner.rb', line 7

def removed_paths
  @removed_paths
end

Instance Method Details

#changed?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/rbwatch/file_scanner.rb', line 15

def changed?
  added_paths.any? || removed_paths.any? || modified_paths.any?
end

#pathsObject



23
24
25
# File 'lib/rbwatch/file_scanner.rb', line 23

def paths
  (added_paths + removed_paths + modified_paths).uniq
end

#totalObject



19
20
21
# File 'lib/rbwatch/file_scanner.rb', line 19

def total
  added_paths.length + removed_paths.length + modified_paths.length
end