Case 1_a:
zip_file = file.sub(directory, '').sub!(/^\//, '')
zipfile.add( zip_file, file)
Case 1_b:
zipfile.add(
file.sub(directory, '').sub!(/^\//, ''),
file)
Case 2 : If the String contains lots of parameters , I prefer write in an array.But I'm not sure to have a line break behind [ is better, or not
def run_remote_focus()
self.setup_remote_focus()
created_at=(Time.now.to_f*1000000).to_i.to_s
settings=[
"-i #{params[:remote_focu][:ip]}",
"-u #{params[:remote_focu][:username]}",
"-p #{params[:remote_focu][:password]}",
"-s #{params[:RemoteFocu].values.join(':')}",
"-m #{params[:af_type]}",
"-t #{params[:remote_focu][:tester]}",
"-n #{@remote_focu.id}",
"-c #{created_at}"
]
cmd=["ruby",
"-I #{@rf[:lib]}",
"#{@rf[:bin]}",
" #{settings.join(' ')}"
]
cmd_str=" #{cmd.join(' ').strip()} & "
Case 3 : I can not tell what is the problem, but it just seems weird
@rf={
folder: "#{Rails.root}#{ENV["module_remote_focus_folder_path"]}",
bin: "#{Rails.root}#{ENV["module_remote_focus_bin_path"]}",
lib: "#{Rails.root}#{ENV["module_remote_focus_lib_path"]}"
}
@rf={folder: "#{Rails.root}#{ENV["module_remote_focus_folder_path"]}",
bin: "#{Rails.root}#{ENV["module_remote_focus_bin_path"]}",
lib: "#{Rails.root}#{ENV["module_remote_focus_lib_path"]}"}