Module: Kommand::Commands
- Defined in:
- lib/kommand/commands.rb,
lib/kommand/commands/help.rb,
lib/kommand/commands/command.rb
Defined Under Namespace
Modules: Command
Classes: Help
Class Method Summary
collapse
Class Method Details
.command(cmd) ⇒ Object
11
12
13
14
|
# File 'lib/kommand/commands.rb', line 11
def self.command(cmd)
raise "Command does not exist: #{cmd}" unless exists?(cmd)
commands.select { |command| command.command_name == cmd.underscore.to_s }.first
end
|
.commands ⇒ Object
3
4
5
|
# File 'lib/kommand/commands.rb', line 3
def self.commands
@commands ||= []
end
|
.exists?(cmd) ⇒ Boolean
7
8
9
|
# File 'lib/kommand/commands.rb', line 7
def self.exists?(cmd)
commands.map(&:command_name).include?(cmd.underscore.to_s)
end
|