-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.rb
28 lines (26 loc) · 865 Bytes
/
lib.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# not used
def split_array(arr)
orders = []
arr.each do |element|
if element.include? "zakupki.gov.ru" #HOST
# http://zakupki.gov.ru/223/purchase/public/purchase/info/common-info.html?noticeId=1239485&epz=true
unified_element = element.scan(/.*noticeId=(\d+)&.*/).first.first
orders << {id: unified_element, type: "solo"}
else
# /epz/order/notice/ea44/view/common-info.html?regNumber=0128200000114003315
unified_element = element.scan(/.*regNumber=(\d+)$/).first.first
orders << {id: unified_element, type: "usual"}
end
end
return orders
end
def clean_trash(html)
# возможно надо удалять <td> </td> и тримить после этого
html.gsub!("<br>", " ")
html.gsub!(/([\r\n\t]|)/, " ")
html.strip!
while html =~ /\s{2,}/
html.gsub!(" ", " ")
end
return html
end