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.107.1 lib/support/outbound_hosts.rb
activemerchant-1.106.0 lib/support/outbound_hosts.rb
activemerchant-1.105.0 lib/support/outbound_hosts.rb
activemerchant-1.104.0 lib/support/outbound_hosts.rb
activemerchant-1.103.0 lib/support/outbound_hosts.rb
activemerchant-1.102.0 lib/support/outbound_hosts.rb
activemerchant-1.101.0 lib/support/outbound_hosts.rb
activemerchant-1.100.0 lib/support/outbound_hosts.rb
activemerchant-1.99.0 lib/support/outbound_hosts.rb
activemerchant-1.98.0 lib/support/outbound_hosts.rb
active_accountability_merchant-1.97.1 lib/support/outbound_hosts.rb
activemerchant-1.97.0 lib/support/outbound_hosts.rb
activemerchant-1.96.0 lib/support/outbound_hosts.rb
activemerchant-1.95.0 lib/support/outbound_hosts.rb
activemerchant-1.94.0 lib/support/outbound_hosts.rb
activemerchant-1.93.0 lib/support/outbound_hosts.rb
activemerchant-1.92.0 lib/support/outbound_hosts.rb
activemerchant-1.91.0 lib/support/outbound_hosts.rb
activemerchant-1.90.0 lib/support/outbound_hosts.rb
activemerchant-1.89.0 lib/support/outbound_hosts.rb