Module: Rake::Sh::Command
- Defined in:
- lib/rake/sh/command.rb
Class Method Summary collapse
- .[](name) ⇒ Object
- .command_names ⇒ Object
- .commands ⇒ Object
- .define(*names, &block) ⇒ Object
- .find(line) ⇒ Object
Class Method Details
.[](name) ⇒ Object
27 28 29 |
# File 'lib/rake/sh/command.rb', line 27 def [](name) commands[name.to_sym] end |
.command_names ⇒ Object
23 24 25 |
# File 'lib/rake/sh/command.rb', line 23 def command_names commands.keys end |
.commands ⇒ Object
5 6 7 |
# File 'lib/rake/sh/command.rb', line 5 def commands @commands ||= {} end |
.define(*names, &block) ⇒ Object
9 10 11 12 13 |
# File 'lib/rake/sh/command.rb', line 9 def define(*names, &block) names.each do |name| commands[name.to_sym] = block end end |
.find(line) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/rake/sh/command.rb', line 15 def find(line) if name = line.split(/\s+/, 2)[0] commands[name.to_sym] else nil end end |