Class: ObjectiveCommand::Commands::Factory
- Defined in:
- lib/objective_command/commands/factory.rb
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, #freeze, #inspect_for_unified_matchers, #instanciate_args, #instanciate_args!, #popen, #ruby, #run, #run_with_options, #sh, #sh!, #sh_args, #sys, #system, #to_a, #to_ocmd, #to_s, #to_sh, #whereis, #|
Constructor Details
Instance Method Details
#new_command(*a, &b) ⇒ Object Also known as: create
17 18 19 20 21 22 23 24 |
# File 'lib/objective_command/commands/factory.rb', line 17 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 |