Module: Hadupils::Commands
- Defined in:
- lib/hadupils/commands.rb,
lib/hadupils/commands/options.rb
Defined Under Namespace
Modules: HadoopExt, HiveExt, Options, UserConf
Classes: Cleanup, Hadoop, Hive, MkTmpFile, RmFile, SimpleCommand, WithTmpDir
Class Method Summary
collapse
Class Method Details
.handler_for(command) ⇒ Object
13
14
15
|
# File 'lib/hadupils/commands.rb', line 13
def self.handler_for(command)
@handlers and @handlers[normalize_command(command)]
end
|
.normalize_command(command) ⇒ Object
9
10
11
|
# File 'lib/hadupils/commands.rb', line 9
def self.normalize_command(command)
command.to_s.downcase
end
|
.register_handler(command, handler) ⇒ Object
17
18
19
20
|
# File 'lib/hadupils/commands.rb', line 17
def self.register_handler(command, handler)
@handlers ||= {}
@handlers[normalize_command(command)] = handler
end
|
.run(command, params = []) ⇒ Object
4
5
6
7
|
# File 'lib/hadupils/commands.rb', line 4
def self.run(command, params=[])
handler = handler_for command
handler.run params
end
|