Sha256: f58fe951b40c04a503ffca2f01b52964735a82e293a6b0a0ad3eac6b80fd8363

Contents?: true

Size: 509 Bytes

Versions: 2

Compression:

Stored size: 509 Bytes

Contents

module Rpub
  module Commands
    class Stats < Base
      identifier 'stats'
      include CompilationHelpers

      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
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rpub-0.4.0 lib/rpub/commands/stats.rb
rpub-0.3.0 lib/rpub/commands/stats.rb