class Shacho::Runner
Public Class Methods
delegate_command(options)
click to toggle source
TODO include active support?
# File lib/shacho/runner.rb, line 27 def delegate_command(options) if options["action"] == "help" Shacho::Util.help else Shacho::Account.send(options["action"], options["params"]) end end
error(message)
click to toggle source
# File lib/shacho/runner.rb, line 22 def error(message) raise RuntimeError, message end
parse_options(args)
click to toggle source
# File lib/shacho/runner.rb, line 10 def parse_options(args) options = {} value = args.shift if COMMANDS.include?(value) options["action"] = value else error "Run shacho help for usage" end options["params"] = args return options end
run!(*args)
click to toggle source
# File lib/shacho/runner.rb, line 4 def run!(*args) options = parse_options(args) delegate_command(options) return 0 end