Sha256: 6dfaba72505a685dd86124dadae2f433526a0818e506f51511cab44cd633f9e0

Contents?: true

Size: 762 Bytes

Versions: 1

Compression:

Stored size: 762 Bytes

Contents

require "rubygems"

module PAC
  require "pac/version"
  require "pac/file"
  require "pac/runtimes"

  class Error < StandardError
  end
  class RuntimeError < Error
  end
  class ProgramError < Error
  end
  class RuntimeUnavailable < RuntimeError
  end

  class << self
    attr_reader :runtime

    def runtime=(runtime)
      raise RuntimeUnavailable, "#{runtime.name} is unavailable on this system" unless runtime.available?
      @runtime = runtime
    end

    def load(url, options = {})
      require "open-uri"
      File.new(open(url, { :proxy => false }.merge(options)).read)
    end

    def read(file)
      File.new(::File.read(file))
    end

    def source(source)
      File.new(source)
    end
  end

  self.runtime = Runtimes.autodetect
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pac-1.0.0 lib/pac.rb