Sha256: 19fc2751cd4e7e03ba31866cad2ec45f2700f8003f70e66bdc23c4d78f4f41b3
Contents?: true
Size: 497 Bytes
Versions: 4
Compression:
Stored size: 497 Bytes
Contents
module Bookshelf class Stream attr_accessor :listener, :content attr_reader :html def initialize(content, listener) @content = content @listener = listener @html = Nokogiri::HTML.parse(content) end def parse traverse(html) end def traverse(node) node.children.each do |child| emit(child) traverse(child) end end def emit(node) listener.send(:tag, node) if node.name =~ /h[1-6]/ end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
bookshelf-1.2.1 | lib/bookshelf/stream.rb |
bookshelf-1.2.0 | lib/bookshelf/stream.rb |
bookshelf-1.1.0 | lib/bookshelf/stream.rb |
bookshelf-1.0.0 | lib/bookshelf/stream.rb |