Sha256: 5a0c5159be0f06b8d0afc38d88b30909f6152b4301a6caae51966e6349ff2b22
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[1-6]/ end end end
Version data entries
6 entries across 6 versions & 1 rubygems