Class: Kachikachi::Counter
- Inherits:
-
Object
- Object
- Kachikachi::Counter
- Defined in:
- lib/kachikachi/counter.rb
Instance Method Summary collapse
- #count ⇒ Object
-
#initialize(cli) ⇒ Counter
constructor
A new instance of Counter.
Constructor Details
#initialize(cli) ⇒ Counter
Returns a new instance of Counter.
5 6 7 |
# File 'lib/kachikachi/counter.rb', line 5 def initialize(cli) @cli = cli end |
Instance Method Details
#count ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/kachikachi/counter.rb', line 9 def count target_patch_list = GitHub.new(@cli.).pull_requests.map(&:target_patch_list).flatten lines_count_list = [] target_patch_list.map { |patch| lines_count = patch.body.only_removed.content.lines.count lines_count_list << lines_count puts "#{patch.file_name}: deleted #{lines_count} lines" unless lines_count.zero? } total_lines_count = lines_count_list.inject(0, :+) puts "👋👋👋 total #{total_lines_count} lines 👋👋👋" end |