Class: Inspector
- Inherits:
-
Object
- Object
- Inspector
- Defined in:
- lib/inspector.rb
Instance Method Summary collapse
- #count(command) ⇒ Object
-
#initialize(history) ⇒ Inspector
constructor
A new instance of Inspector.
- #top(n) ⇒ Object
- #top_ten ⇒ Object
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_ten ⇒ Object
11 12 13 |
# File 'lib/inspector.rb', line 11 def top_ten top(10) end |