Class: Rexer::Definition::Diff

Inherits:
Object
  • Object
show all
Defined in:
lib/rexer/definition/diff.rb

Instance Method Summary collapse

Constructor Details

#initialize(old_data, new_data) ⇒ Diff

Returns a new instance of Diff.



4
5
6
7
# File 'lib/rexer/definition/diff.rb', line 4

def initialize(old_data, new_data)
  @old_data = old_data
  @new_data = new_data
end

Instance Method Details

#added_pluginsObject



9
10
11
# File 'lib/rexer/definition/diff.rb', line 9

def added_plugins
  new_data.plugins - old_data.plugins
end

#added_themesObject



13
14
15
# File 'lib/rexer/definition/diff.rb', line 13

def added_themes
  new_data.themes - old_data.themes
end

#deleted_pluginsObject



17
18
19
# File 'lib/rexer/definition/diff.rb', line 17

def deleted_plugins
  old_data.plugins - new_data.plugins
end

#deleted_themesObject



21
22
23
# File 'lib/rexer/definition/diff.rb', line 21

def deleted_themes
  old_data.themes - new_data.themes
end

#source_changed_pluginsObject



25
26
27
28
29
30
31
32
# File 'lib/rexer/definition/diff.rb', line 25

def source_changed_plugins
  old_plugins = old_data.plugins

  (new_data.plugins & old_plugins).select do |new_plugin|
    old_plugin = old_plugins.find { _1.name == new_plugin.name }
    plugin_source_changed?(old_plugin, new_plugin)
  end
end

#source_changed_themesObject



34
35
36
37
38
39
40
41
# File 'lib/rexer/definition/diff.rb', line 34

def source_changed_themes
  old_themes = old_data.themes

  (new_data.themes & old_themes).select do |new_theme|
    old_theme = old_themes.find { _1.name == new_theme.name }
    theme_source_changed?(old_theme, new_theme)
  end
end