Class: DatabasePatcher::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/database_patcher/fetcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(connection, interface) ⇒ Fetcher

Returns a new instance of Fetcher.



3
4
5
6
# File 'lib/database_patcher/fetcher.rb', line 3

def initialize(connection, interface)
  @connection = connection
  @interface = interface
end

Instance Method Details

#get_intalled_patchesObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/database_patcher/fetcher.rb', line 8

def get_intalled_patches
  patches = get_patches
  installed_patches = []
  uniq_indentifiers = get_already_applied_patch_uniq_indentifiers

  patches.each do |patch|
    break unless uniq_indentifiers.include?(patch.uniq_indentifier)
    installed_patches.push(patch)
  end

  installed_patches.reverse
end

#get_pending_patchesObject



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/database_patcher/fetcher.rb', line 21

def get_pending_patches
  patches = get_patches
  pending_patches = []
  uniq_indentifiers = get_already_applied_patch_uniq_indentifiers

  patches.each do |patch|
    break if uniq_indentifiers.include?(patch.uniq_indentifier)
    pending_patches.push(patch)
  end

  pending_patches
end