lib/carrasco/command.rb in carrasco-0.1.5 vs lib/carrasco/command.rb in carrasco-0.1.6
- old
+ new
@@ -10,7 +10,17 @@
@command_name = command_name
@command = options[:command] || command_name
@help = options[:help] || command_name
@description = options[:description] || "description not given"
end
+
+ def inject_into_class(klass)
+ command = self
+ klass.desc(help, description)
+ klass.class_eval do
+ define_method(command.command_name) do
+ execute_command(command)
+ end
+ end
+ end
end
end