Sha256: 6492b4b3820506789978abce9987d3d31aaf051407b5073de1c0fc15fa9a6614

Contents?: true

Size: 533 Bytes

Versions: 1

Compression:

Stored size: 533 Bytes

Contents

require_relative "../url_trimmer"

module URLTrimmer
  class Differ
    def self.between(urls1, urls2)
      unique_urls1 = Worker.uniq_by_domain(urls1)
      unique_urls1.map! { |url| url[Worker::URL_REGEXP, 0]  }
      domains1 = unique_urls1.map { |url| DomainName(url).domain }
      
      unique_urls2 = Worker.uniq_by_domain(urls2)
      unique_urls2.reject! do |url|
        u = url[Worker::URL_REGEXP, 0]
        domains1.include?(DomainName(u).domain)
      end
      unique_urls2.sort!
      unique_urls2
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
url_trimmer-0.1.0 lib/url_trimmer/differ.rb