Sha256: 1eda4617c096446f65f7f3b68c7920812f0e1bfeca6fe7649db8954a6ea9ecc5
Contents?: true
Size: 494 Bytes
Versions: 6
Compression:
Stored size: 494 Bytes
Contents
module Kitabu 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[2-6]/ end end end
Version data entries
6 entries across 6 versions & 1 rubygems