Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyApp < Thor
- def method_missing(meth, *args)
- namespaces = meth.to_s.split(':')
- task = namespaces.pop
- possible_class = namespaces.map { |unclass| unclass.gsub(/(?:^|_)(.)/) { $1.upcase } }.join('::')
- if(klass = self.class.const_get(possible_class))
- klass.new.send(task, *args)
- end
- end
- end
Add Comment
Please, Sign In to add comment