class Saxerator::DocumentFragment

Public Class Methods

new(source, config = nil, latches = []) click to toggle source
# File lib/saxerator/document_fragment.rb, line 6
def initialize(source, config = nil, latches = [])
  @source = source
  @latches = latches
  @config = config
end

Public Instance Methods

each(&block) click to toggle source
# File lib/saxerator/document_fragment.rb, line 12
def each(&block)
  return to_enum unless block_given?

  # Always have to start at the beginning of a File
  @source.rewind if @source.respond_to?(:rewind)

  reader = Parser::LatchedAccumulator.new(@config, @latches, block)
  @config.adapter.parse(@source, reader)
end