This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def script file_name | |
array = [] | |
trans_hash = {} | |
File.open(file_name){ |f| f.each { |s|array << s }} | |
hash = array.group_by{ |a| a.split[6]} | |
hash.each do |order, operations| | |
trans_hash[order] = [] | |
operations.each do |operation| | |
if operation.present? | |
fields = operation.split |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rspec' | |
def includes arg1, arg2 | |
arg1 = arg1.split if arg1.is_a? String | |
arg2 = arg2.split if arg2.is_a? String | |
not (arg1 & arg2).empty? | |
end | |
def includes_only arg1, arg2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: utf-8 | |
require 'mechanize' | |
class AvitoParser | |
# Base method in which we fetch seling engine with our search query | |
# and go through given number of pages with god blessed regexps | |
def fetch_engine(search_query, number_of_pages, city) | |
@search_query = search_query | |
host = "http://avito.ru" |