class Saxerator::Parser::LatchedAccumulator

Public Class Methods

new(config, latches, block) click to toggle source
# File lib/saxerator/parser/latched_accumulator.rb, line 4
def initialize(config, latches, block)
  @latches = latches
  @accumulator = Accumulator.new(config, block)
  @ignore_namespaces = config.ignore_namespaces?
end

Public Instance Methods

characters(string) click to toggle source
# File lib/saxerator/parser/latched_accumulator.rb, line 23
def characters(string)
  check_latches_and_passthrough(:characters, string)
end
check_latches_and_passthrough(method, *args) click to toggle source
# File lib/saxerator/parser/latched_accumulator.rb, line 10
def check_latches_and_passthrough(method, *args)
  @latches.each { |latch| latch.send(method, *args) }
  @accumulator.send(method, *args) if @accumulator.accumulating? || @latches.all?(&:open?)
end
end_element(name) click to toggle source
# File lib/saxerator/parser/latched_accumulator.rb, line 19
def end_element(name)
  check_latches_and_passthrough(:end_element, name)
end
ignore_namespaces?() click to toggle source
# File lib/saxerator/parser/latched_accumulator.rb, line 27
def ignore_namespaces?
  @ignore_namespaces
end
start_element(name, attrs = []) click to toggle source
# File lib/saxerator/parser/latched_accumulator.rb, line 15
def start_element(name, attrs = [])
  check_latches_and_passthrough(:start_element, name, attrs)
end