lib/command.rb in dev_tasks-1.0.9 vs lib/command.rb in dev_tasks-1.0.10
- old
+ new
@@ -1,17 +1,25 @@
class Command < Hash
def initialize command
- self[:input] = command
- self[:timeout] = 0
- self[:directory] = ''
- self[:exit_code] = 0
- self[:output] = ''
- self[:error] = ''
- self[:machine_name] = ''
- self[:user_name] = ''
- self[:start_time] = nil
- self[:end_time] = nil
+ if(command.kind_of?(String))
+ self[:input] = command
+ self[:timeout] = 0
+ self[:directory] = ''
+ self[:exit_code] = 0
+ self[:output] = ''
+ self[:error] = ''
+ self[:machine_name] = ''
+ self[:user_name] = ''
+ self[:start_time] = nil
+ self[:end_time] = nil
+ end
+
+ if(command.kind_of?(Hash))
+ command.each{|k,v|
+ self[k.to_sym]=v
+ }
+ end
end
def execute
Logger.start_command self
\ No newline at end of file