Sha256: 330c1c3790c72015b99a00364bca395c4f455be1374eec76be6096b8c71937c5
Contents?: true
Size: 738 Bytes
Versions: 4
Compression:
Stored size: 738 Bytes
Contents
module Bookshelf class Stats attr_reader :root_dir def initialize(root_dir) @root_dir = root_dir end def text @text ||= html.text end def html @html ||= Nokogiri::HTML(content) end def words @words ||= text.split(" ").size end def chapters @chapters ||= html.css(".chapter").size end def images @images ||= html.css("img").size end def footnotes @footnotes ||= html.css("p.footnote").size end def links @links ||= html.css("[href^='http']").size end def code_blocks @code_blocks ||= html.css("pre").size end def content @content ||= Parser::HTML.new(root_dir).content end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
bookshelf-1.2.1 | lib/bookshelf/stats.rb |
bookshelf-1.2.0 | lib/bookshelf/stats.rb |
bookshelf-1.1.0 | lib/bookshelf/stats.rb |
bookshelf-1.0.0 | lib/bookshelf/stats.rb |