Sha256: 2283d553853ce8496350ad2fcd724e3a3d1a1fe41da102e9557f9a7a8187632f

Contents?: true

Size: 558 Bytes

Versions: 98

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

98 entries across 98 versions & 6 rubygems

Version Path
activemerchant-1.61.0 lib/support/outbound_hosts.rb
activemerchant-1.60.0 lib/support/outbound_hosts.rb
activemerchant-1.59.0 lib/support/outbound_hosts.rb
activemerchant-1.58.0 lib/support/outbound_hosts.rb
activemerchant-1.57.0 lib/support/outbound_hosts.rb
activemerchant-1.56.0 lib/support/outbound_hosts.rb
activemerchant-1.55.0 lib/support/outbound_hosts.rb
activemerchant-1.54.0 lib/support/outbound_hosts.rb
activemerchant-1.53.0 lib/support/outbound_hosts.rb
start_activemerchant-1.50.0 lib/support/outbound_hosts.rb
solidus_backend-1.0.0.pre3 vendor/bundle/gems/activemerchant-1.48.0/lib/support/outbound_hosts.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/activemerchant-1.48.0/lib/support/outbound_hosts.rb
activemerchant-1.52.0 lib/support/outbound_hosts.rb
activemerchant-1.51.0 lib/support/outbound_hosts.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/activemerchant-1.48.0/lib/support/outbound_hosts.rb
activemerchant-1.50.0 lib/support/outbound_hosts.rb
activemerchant-1.49.0 lib/support/outbound_hosts.rb
activemerchant-1.48.0 lib/support/outbound_hosts.rb