Method: BigBrother::Counter.count_commands

Defined in:
lib/big_brother/counter.rb

.count_commands(lines) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/big_brother/counter.rb', line 11

def self.count_commands(lines)
  commands = normalize_commands(lines)
  commands = reject_ignored_commands(commands)
  commands.each_with_object({}) do |(command, argument), count_hash|
    count_hash[command] ||= {}
    count_hash[command][argument] ||= 0
    count_hash[command][argument] += 1
  end
end