Class: Rpub::Commands::Stats
- Inherits:
-
Rpub::Command
- Object
- Rpub::Command
- Rpub::Commands::Stats
- Defined in:
- lib/rpub/commands/stats.rb
Instance Attribute Summary
Attributes inherited from Rpub::Command
Instance Method Summary (collapse)
Methods inherited from Rpub::Command
Constructor Details
This class inherits a constructor from Rpub::Command
Instance Method Details
- (Object) run
4 5 6 7 8 9 10 11 12 |
# File 'lib/rpub/commands/stats.rb', line 4 def run text = Rpub::Preview.new(context, source).text puts "#{text.words.size} words" puts "#{(text.words.size.to_f / 500).ceil} pages" puts "#{text.sentences} sentences" puts "#{text.avg_sentence_length} avg sentence length" puts format("%.2f ari", text.ari) puts format("%.2f clf", text.clf) end |