Class: Rpub::Commands::Stats
- Includes:
- Rpub::CompilationHelpers
- Defined in:
- lib/rpub/commands/stats.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods included from Rpub::CompilationHelpers
#concatenated_document, #config, #create_book, #layout, #markdown_files, #styles
Methods inherited from Base
Methods included from SubclassTracker
#each, #identifier, #inherited, #matching
Constructor Details
This class inherits a constructor from Rpub::Commands::Base
Instance Method Details
#invoke ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rpub/commands/stats.rb', line 7 def invoke super text = Nokogiri::HTML(concatenated_document.to_html).xpath('//text()').to_s puts "#{text.words.size} words" puts "#{text.words.size / 500} pages" puts "#{text.sentences} sentences" puts "#{text.avg_sentence_length} avg sentence length" puts "#{text.ari} ari" puts "#{text.clf} clf" end |