Class: Munge::Function::Clean

Inherits:
Object
  • Object
show all
Defined in:
lib/munge/function/clean.rb

Instance Method Summary collapse

Constructor Details

#initialize(memory:, destination:) ⇒ Clean

Returns a new instance of Clean.



4
5
6
7
# File 'lib/munge/function/clean.rb', line 4

def initialize(memory:, destination:)
  @memory = memory
  @destination = destination
end

Instance Method Details

#callObject



9
10
11
12
13
14
15
# File 'lib/munge/function/clean.rb', line 9

def call
  orphans = @destination.tree - @memory.tree

  orphans.each do |orphan|
    @destination.rm(orphan)
  end
end