Class: Gonzui::UpdateDiff
- Inherits:
-
Object
- Object
- Gonzui::UpdateDiff
- Defined in:
- lib/gonzui/updater.rb
Instance Method Summary collapse
- #each_added_path ⇒ Object
- #each_removed_path ⇒ Object
- #each_updated_path ⇒ Object
-
#initialize(config, dbm, fetcher, package_id, package_name, options = {}) ⇒ UpdateDiff
constructor
A new instance of UpdateDiff.
- #ncontents ⇒ Object
Constructor Details
#initialize(config, dbm, fetcher, package_id, package_name, options = {}) ⇒ UpdateDiff
Returns a new instance of UpdateDiff.
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/gonzui/updater.rb', line 97 def initialize(config, dbm, fetcher, package_id, package_name, = {}) @config = config @dbm = dbm @fetcher = fetcher @package_id = package_id @package_name = package_name @exclude_pattern = [:exclude_pattern] @paths_to_be_removed = [] @paths_to_be_added = [] @paths_to_be_updated = [] @paths_in_db = {} @dbm.get_path_ids(package_id).each {|path_id| normalized_path = @dbm.get_path(path_id) @paths_in_db[normalized_path] = :unseen } collect end |
Instance Method Details
#each_added_path ⇒ Object
162 163 164 165 166 |
# File 'lib/gonzui/updater.rb', line 162 def each_added_path @paths_to_be_added.each {|relative_path, normalized_path| yield(relative_path, normalized_path) } end |
#each_removed_path ⇒ Object
174 175 176 177 178 |
# File 'lib/gonzui/updater.rb', line 174 def each_removed_path @paths_to_be_removed.each {|normalized_path| yield(normalized_path) } end |
#each_updated_path ⇒ Object
168 169 170 171 172 |
# File 'lib/gonzui/updater.rb', line 168 def each_updated_path @paths_to_be_updated.each {|relative_path, normalized_path| yield(relative_path, normalized_path) } end |
#ncontents ⇒ Object
180 181 182 183 |
# File 'lib/gonzui/updater.rb', line 180 def ncontents @paths_to_be_added.length + @paths_to_be_updated.length + @paths_to_be_removed.length end |