class Todo::Cli
Attributes
args[R]
cmd[R]
opts[R]
Public Class Methods
new(args)
click to toggle source
# File lib/todo/cli.rb, line 15 def initialize(args) @args = args @cmd = @args.shift || raise('No command given') end
Public Instance Methods
run()
click to toggle source
# File lib/todo/cli.rb, line 20 def run args, opts = const.parse(self.args) const.new(args, opts).run rescue Error => e abort "Error: #{e.message}" end
Private Instance Methods
const()
click to toggle source
# File lib/todo/cli.rb, line 29 def const @const ||= Cli.const_get(camelize(cmd)) rescue NameError fail Error.new(MSGS[:unknown_cmd] % cmd) end