Class: Saxerator::Latches::WithAttributes
- Inherits:
-
AbstractLatch
- Object
- SaxHandler
- AbstractLatch
- Saxerator::Latches::WithAttributes
- Defined in:
- lib/saxerator/latches/with_attributes.rb
Instance Method Summary collapse
- #end_element(_) ⇒ Object
-
#initialize(attrs) ⇒ WithAttributes
constructor
A new instance of WithAttributes.
- #start_element(_, attributes) ⇒ Object
Methods inherited from AbstractLatch
Methods inherited from SaxHandler
Constructor Details
#initialize(attrs) ⇒ WithAttributes
Returns a new instance of WithAttributes.
6 7 8 |
# File 'lib/saxerator/latches/with_attributes.rb', line 6 def initialize(attrs) @attrs = attrs end |
Instance Method Details
#end_element(_) ⇒ Object
19 20 21 |
# File 'lib/saxerator/latches/with_attributes.rb', line 19 def end_element(_) close end |
#start_element(_, attributes) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/saxerator/latches/with_attributes.rb', line 10 def start_element(_, attributes) attributes = Hash[attributes] if @attrs.all? { |k, v| attributes[k] && (v.nil? || attributes[k] == v) } open else close end end |