Class: Ppl::Application::CommandSuite

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/ppl/application/command_suite.rb

Instance Method Summary collapse

Constructor Details

#initializeCommandSuite

Returns a new instance of CommandSuite.



8
9
10
# File 'lib/ppl/application/command_suite.rb', line 8

def initialize
  @commands = []
end

Instance Method Details

#[](index) ⇒ Object



28
29
30
# File 'lib/ppl/application/command_suite.rb', line 28

def [](index)
  @commands[index]
end

#add_command(command) ⇒ Object



12
13
14
# File 'lib/ppl/application/command_suite.rb', line 12

def add_command(command)
  @commands.push command
end

#eachObject



16
17
18
# File 'lib/ppl/application/command_suite.rb', line 16

def each
  @commands.each { |command| yield command }
end

#find_command(name) ⇒ Object



20
21
22
# File 'lib/ppl/application/command_suite.rb', line 20

def find_command(name)
  @commands.select { |command| command.name == name }.first
end

#sort_by_nameObject



24
25
26
# File 'lib/ppl/application/command_suite.rb', line 24

def sort_by_name
  @commands.sort! { |a, b| a.name <=> b.name }
end