Class: PAC::File
- Inherits:
-
Object
- Object
- PAC::File
- Defined in:
- lib/pac/file.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #find(url) ⇒ Object
-
#initialize(source) ⇒ File
constructor
A new instance of File.
Constructor Details
#initialize(source) ⇒ File
Returns a new instance of File.
9 10 11 12 13 |
# File 'lib/pac/file.rb', line 9 def initialize(source) @source = source.dup.freeze @context = PAC.runtime.compile(@source) @context.include Functions end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
7 8 9 |
# File 'lib/pac/file.rb', line 7 def context @context end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
7 8 9 |
# File 'lib/pac/file.rb', line 7 def source @source end |
Instance Method Details
#find(url) ⇒ Object
15 16 17 18 19 |
# File 'lib/pac/file.rb', line 15 def find(url) uri = URI.parse(url) raise ArgumentError, "url is missing host" unless uri.host context.call("FindProxyForURL", url, uri.host) end |