30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/hookify/command.rb', line 30
def parse(command)
parts = command.split(':').collect {|i| i.gsub("-", "_")}
case parts.size
when 1
begin
return "Hookify::Command::#{parts[0].camelize}".constantize, :create
rescue NameError, NoMethodError
return Hookify::Command::Base, parts[0]
end
when 2
begin
return "Hookify::Command::#{parts[0].camelize}".constantize, parts[1]
rescue NameError
raise InvalidCommand
end
else
raise InvalidCommand
end
end
|