Class: Commands::Factory
Instance Attribute Summary
Attributes inherited from Command
#args, #command, #dir, #error, #input, #open_mode, #output
Instance Method Summary collapse
-
#initialize ⇒ Factory
constructor
A new instance of Factory.
- #new_command(*a, &b) ⇒ Object (also: #create)
Methods inherited from Command
#+, #<, #<<, #>, #>>, [], #[], #arg_string, #exec, #expand, #fork, #instanciate_args, #instanciate_args!, #popen, #ruby, #run, #run_with_options, #sh, #sh!, #sh_args, #sys, #system, #to_a, #to_cmd, #to_s, #to_sh, #whereis, #|
Constructor Details
Instance Method Details
#new_command(*a, &b) ⇒ Object Also known as: create
15 16 17 18 19 20 21 22 |
# File 'lib/commands/factory.rb', line 15 def new_command ( *a, &b ) cmd = @command_class.new(*a, &b) instance_variables.each do |var| next if var =~ /^@command(_class)?$/ cmd.send(var[1..-1] + '=', instance_variable_get(var)) end cmd end |