Module: Rake::Sh::Command

Defined in:
lib/rake/sh/command.rb

Class Method Summary collapse

Class Method Details

.[](name) ⇒ Object



27
28
29
# File 'lib/rake/sh/command.rb', line 27

def [](name)
  commands[name.to_sym]
end

.command_namesObject



23
24
25
# File 'lib/rake/sh/command.rb', line 23

def command_names
  commands.keys
end

.commandsObject



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