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.



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

def initialize
  @commands = []
end

Instance Method Details

#[](index) ⇒ Object



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

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

#add_command(command) ⇒ Object



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

def add_command(command)
  @commands.push command
end

#eachObject



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

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

#find_command(name) ⇒ Object



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

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

#sort_by_nameObject



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

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