I am aware of ".uniq
" method but it is not working here. I pushed Mechanize link instances in an array and applied it but it is not removing duplicates. Here is the array..
#<Mechanize::Page::Link "2" "/inquiry/inquiry-results.jsp?d-16544-p=2&middleName=&firstName=&lastName=JOHN">,
#<Mechanize::Page::Link "3" "/inquiry/inquiry-results.jsp?d-16544-p=3&middleName=&firstName=&lastName=JOHN">,
#<Mechanize::Page::Link "4" "/inquiry/inquiry-results.jsp?d-16544-p=4&middleName=&firstName=&lastName=JOHN">,
......................................................................................
#<Mechanize::Page::Link "2" "/inquiry/inquiry-results.jsp?d-16544-p=2&middleName=&firstName=&lastName=JOHN">,
#<Mechanize::Page::Link "3" "/inquiry/inquiry-results.jsp?d-16544-p=3&middleName=&firstName=&lastName=JOHN">,
#<Mechanize::Page::Link "4" "/inquiry/inquiry-results.jsp?d-16544-p=4&middleName=&firstName=&lastName=JOHN">,
#<Mechanize::Page::Link "5" "/inquiry/inquiry-results.jsp?d-16544-p=5&middleName=&firstName=&lastName=JOHN">,
#<Mechanize::Page::Link "6" "/inquiry/inquiry-results.jsp?d-16544-p=6&middleName=&firstName=&lastName=JOHN">,
but still after using .".uniq
" result is same. Here is the ruby code I am using..
page.links.each {|link|
page_links.push link if link.href =~ /inquiry-results/i and link.text =~ /[0-9]+/
}