Class: CG::Command
- Inherits:
-
Object
- Object
- CG::Command
- Defined in:
- lib/cg/command.rb
Instance Method Summary collapse
-
#initialize(*args) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(*args) ⇒ Command
Returns a new instance of Command.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/cg/command.rb', line 5 def initialize(*args) Dir[File.join(File.dirname(__FILE__), "command", "*.rb")].each do |file| require file end namespace = args.shift.capitalize rescue nil namespace = Kernel.const_get("Command").const_get(namespace) rescue nil task = args.shift.downcase rescue nil if namespace if task namespace.send(task, *args) else namespace.send("main", *args) end else puts CG::VERSION end end |