Sha256: cf9e6ad6641bbadb833a4d8519b8ec04a27104921b2c5e88b7c0c908a09a334e

Contents?: true

Size: 552 Bytes

Versions: 33

Compression:

Stored size: 552 Bytes

Contents

#!/usr/bin/env ruby
require 'pry'

require 'proxy_pac_rb'

string = <<-EOS
function FindProxyForURL(url, host) {
  if ( myIpAddress() == '127.0.0.2' ) {
    return "DIRECT";
  } else {
    return "PROXY localhost:8080";
  }
}
EOS

environment = ProxyPacRb::Environment.new(client_ip: '127.0.0.1')
file = ProxyPacRb::Parser.new(environment).source(string)
puts(file.find('http://localhost'))

environment = ProxyPacRb::Environment.new(client_ip: '127.0.0.2')
file = ProxyPacRb::Parser.new(environment).source(string)
puts(file.find('http://localhost'))

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
proxy_pac_rb-2.1.0 tmp/script.rb
proxy_pac_rb-2.0.0 tmp/script.rb
proxy_pac_rb-1.0.0 tmp/script.rb
proxy_pac_rb-0.9.1 tmp/script.rb
proxy_pac_rb-0.8.2 tmp/script.rb
proxy_pac_rb-0.8.1 tmp/script.rb
proxy_pac_rb-0.8.0 tmp/script.rb
proxy_pac_rb-0.7.0 tmp/script.rb
proxy_pac_rb-0.6.9 tmp/script.rb
proxy_pac_rb-0.6.8 tmp/script.rb
proxy_pac_rb-0.6.7 tmp/script.rb
proxy_pac_rb-0.6.5 tmp/script.rb
proxy_pac_rb-0.6.4 tmp/script.rb
proxy_pac_rb-0.6.3 tmp/script.rb
proxy_pac_rb-0.6.2 tmp/script.rb
proxy_pac_rb-0.6.1 tmp/script.rb
proxy_pac_rb-0.6.0 tmp/script.rb
proxy_pac_rb-0.5.10 tmp/script.rb
proxy_pac_rb-0.5.9 tmp/script.rb
proxy_pac_rb-0.5.8 tmp/script.rb