class Saxerator::Latches::WithAttributes

Public Class Methods

new(attrs) click to toggle source
# File lib/saxerator/latches/with_attributes.rb, line 6
def initialize(attrs)
  @attrs = attrs
end

Public Instance Methods

end_element(_) click to toggle source
# File lib/saxerator/latches/with_attributes.rb, line 19
def end_element(_)
  close
end
start_element(_, attributes) click to toggle source
# 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