lib/imperituroard/projects/ukaz60/ukaz60_add_func.rb in imperituroard-1.1.17 vs lib/imperituroard/projects/ukaz60/ukaz60_add_func.rb in imperituroard-1.1.18

- old
+ new

@@ -74,40 +74,42 @@ #p "Step3 processed_domain_in_url: #{processed_domain_in_url}" #if include / then it is url. Else - domain if !processed_domain_in_url.include? "/" #it is domain. Process domain #if it is kirillica then process - if processed_domain_in_url.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/) + #if processed_domain_in_url.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/) + if processed_domain_in_url.match(/[а-яА-ЯЁё]/) processed_domain_in_url = SimpleIDN.to_ascii(processed_domain_in_url) end domain_only = domain_only + processed_domain_in_url - type = "domain" + type = 'domain' else #it is url. process url - hh = processed_domain_in_url.split("/") + hh = processed_domain_in_url.split('/') domain_only = hh[0] - if domain_only.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/) + #if domain_only.match(/а|б|в|г|д|е|ж|ё|Ё|з|и|й|к|л|м|н|о|п|р|с|т|у|ф|х|ц|ч|ш|щ|ь|ы|ъ|э|ю|я|А|Б|В|Г|Д|Е|Ж|З|И|Й|К|Л|М|Н|О|П|Р|С|Т|У|Ф|Х|Ц|Ч|Ш|Щ|Ь|Ы|Ъ|Э|Ю|Я/) + if domain_only.match(/[а-яА-ЯЁё]/) hh[0] = SimpleIDN.to_ascii(domain_only) - processed_domain_in_url = "" + processed_domain_in_url = '' for t in hh - processed_domain_in_url = processed_domain_in_url + t + "/" + processed_domain_in_url = processed_domain_in_url + t + '/' end sss1len = processed_domain_in_url.size processed_domain_in_url = processed_domain_in_url[0..sss1len-2] end - type = "url" + type = 'url' end else - type = "empty" + type = 'empty' end - output_answer = {:code => 200, :result => "Request processed", :ishodnye_dannye => stroka, :first_url => first_url, :processed_domain_in_url => processed_domain_in_url, :domain_only => domain_only, :protocol => protocol, :type => type} + output_answer = {:code => 200, :result => 'Request processed', :ishodnye_dannye => stroka, :first_url => first_url, :processed_domain_in_url => processed_domain_in_url, :domain_only => domain_only, :protocol => protocol, :type => type} else - output_answer = {:code => 202, :result => "Data not found"} + output_answer = {:code => 202, :result => 'Data not found'} end rescue - output_answer = {:code => 507, :result => "Something wrong"} + output_answer = {:code => 507, :result => 'Something wrong'} end output_answer end @@ -130,15 +132,15 @@ if aaa[1].to_i>0 && aaa[3].to_i==0 && aaa[4].to_i==0 && aaa[5].to_i==0 && aaa[6].to_i==0 && aaa[7].to_i==0 result_out[aaa[0]] = "Ok" #result_out.push({aaa[0] => "Ok"}) num_ok = num_ok + 1 else - result_out[aaa[0]] = "Failed" + result_out[aaa[0]] = 'Failed' #result_out.push({aaa[0] => "Failed"}) num_failed = num_failed + 1 end rescue - result_out["unknown"] = aaa.to_s + result_out['unknown'] = aaa.to_s #result_out.push({"unknown" => aaa.to_s}) num_failed = num_failed + 1 end end output_data = {:code => 200, :result => "ansible_answer_parse: Request completed successfully", :body => {:list => result_out, :num_ok => num_ok, :num_failed => num_failed}}