Class: TagRemover::Worker

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

Instance Method Summary collapse

Constructor Details

#initialize(input, output, opts) ⇒ Worker

Returns a new instance of Worker.



6
7
8
9
10
# File 'lib/tag_remover.rb', line 6

def initialize input, output, opts
  @input = input
  @output = output
  @opts = opts
end

Instance Method Details

#performObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/tag_remover.rb', line 12

def perform
  @tags_to_remove = @opts[:remove_tags] || []

  @in_tag = nil
  @depth = 0

  each_tag do |tag, type|
    process_tag tag, type
  end

  if @opts[:close_streams]
    @input.close
    @output.close
  end
end