Class: Inspector

Inherits:
Object
  • Object
show all
Defined in:
lib/inspector.rb

Instance Method Summary collapse

Constructor Details

#initialize(history) ⇒ Inspector

Returns a new instance of Inspector.



2
3
4
5
# File 'lib/inspector.rb', line 2

def initialize(history)
  @history ||= history
  @command_counts ||= count_commands(isolated_commands)
end

Instance Method Details

#count(command) ⇒ Object



15
16
17
# File 'lib/inspector.rb', line 15

def count(command)
  command_counts[command].to_i
end

#top(n) ⇒ Object



7
8
9
# File 'lib/inspector.rb', line 7

def top(n)
  top_commands.take(n)
end

#top_tenObject



11
12
13
# File 'lib/inspector.rb', line 11

def top_ten
  top(10)
end