Class: Lazyme::Main
- Inherits:
-
Object
- Object
- Lazyme::Main
- Defined in:
- lib/lazyme.rb
Constant Summary collapse
- SIZE_LIMIT =
80- COUNT_LIMIT =
2
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call ⇒ Object
10 11 12 |
# File 'lib/lazyme.rb', line 10 def self.call new.call end |
Instance Method Details
#call ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lazyme.rb', line 14 def call count = Hash.new(0) File.read(history_file_path).force_encoding('BINARY'). encode("UTF-8", invalid: :replace, undef: :replace). split("\n").map do |line| line.split(';').last end.each do |item| if trimmed = trim(item) count[trimmed] = count[trimmed] + 1 end end rows = count.sort_by {|_, v| v }.select { |el| el[1] > COUNT_LIMIT } puts build_table(rows) end |