Class: Saxerator::DocumentFragment
- Inherits:
-
Object
- Object
- Saxerator::DocumentFragment
- Includes:
- Enumerable, DSL
- Defined in:
- lib/saxerator/document_fragment.rb
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(source, config = nil, latches = []) ⇒ DocumentFragment
constructor
A new instance of DocumentFragment.
Methods included from DSL
#at_depth, #child_of, #for_tag, #for_tags, #with_attribute, #with_attributes, #within
Constructor Details
#initialize(source, config = nil, latches = []) ⇒ DocumentFragment
Returns a new instance of DocumentFragment.
6 7 8 9 10 |
# File 'lib/saxerator/document_fragment.rb', line 6 def initialize(source, config = nil, latches = []) @source = source @latches = latches @config = config end |
Instance Method Details
#each(&block) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# 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 |