Sha256: 2283d553853ce8496350ad2fcd724e3a3d1a1fe41da102e9557f9a7a8187632f

Contents?: true

Size: 558 Bytes

Versions: 107

Compression:

Stored size: 558 Bytes

Contents

require 'uri'
require 'set'

class OutboundHosts
  def self.list
    hosts = Set.new
    invalid_lines = Set.new

    Dir['lib/**/*.rb'].each do |file|
      content = File.read(file)

      content.each_line do |line|
        next if line =~ /homepage_url/

        if line =~ /("|')(https:\/\/[^'"]*)("|')/
          begin
            uri = URI.parse($2)
            hosts << "#{uri.host}:#{uri.port}"
          rescue URI::InvalidURIError
            invalid_lines << line
          end
        end
      end
    end

    [hosts, invalid_lines]
  end
end

Version data entries

107 entries across 107 versions & 7 rubygems

Version Path
activemerchant-1.88.0 lib/support/outbound_hosts.rb
activemerchant-1.87.0 lib/support/outbound_hosts.rb
activemerchant-1.86.0 lib/support/outbound_hosts.rb
activemerchant-1.85.0 lib/support/outbound_hosts.rb
activemerchant-1.84.0 lib/support/outbound_hosts.rb
activemerchant-1.83.0 lib/support/outbound_hosts.rb
activemerchant-1.82.0 lib/support/outbound_hosts.rb
activemerchant-1.81.0 lib/support/outbound_hosts.rb
activemerchant-1.80.0 lib/support/outbound_hosts.rb
activemerchant-1.79.2 lib/support/outbound_hosts.rb
activemerchant-1.79.1 lib/support/outbound_hosts.rb
activemerchant-1.79.0 lib/support/outbound_hosts.rb
activemerchant-1.78.0 lib/support/outbound_hosts.rb
activemerchant-1.77.0 lib/support/outbound_hosts.rb
activemerchant-1.76.0 lib/support/outbound_hosts.rb
activemerchant-1.75.0 lib/support/outbound_hosts.rb
activemerchant-1.74.0 lib/support/outbound_hosts.rb
activemerchant-1.73.0 lib/support/outbound_hosts.rb
activemerchant-1.72.0 lib/support/outbound_hosts.rb
activemerchant-1.71.0 lib/support/outbound_hosts.rb