Class: Saxerator::Latches::ForTags

Inherits:
AbstractLatch show all
Defined in:
lib/saxerator/latches/for_tags.rb

Instance Method Summary collapse

Methods inherited from AbstractLatch

#close, #open, #open?

Methods inherited from SaxHandler

#characters

Constructor Details

#initialize(names) ⇒ ForTags

Returns a new instance of ForTags.



6
7
8
# File 'lib/saxerator/latches/for_tags.rb', line 6

def initialize(names)
  @names = names
end

Instance Method Details

#end_element(name) ⇒ Object



14
15
16
# File 'lib/saxerator/latches/for_tags.rb', line 14

def end_element(name)
  close if @names.include?(name)
end

#start_element(name, _) ⇒ Object



10
11
12
# File 'lib/saxerator/latches/for_tags.rb', line 10

def start_element(name, _)
  @names.include?(name) ? open : close
end