Class: ProxyPacRb::Parser
- Inherits:
-
Object
- Object
- ProxyPacRb::Parser
- Defined in:
- lib/proxy_pac_rb/parser.rb
Overview
Proxy Pac parser
parser = Parser.new parser.load(‘example.com/proxy.pac’) parser.read(‘file.pac’)
string = ” parser.source(string)
Instance Method Summary collapse
-
#initialize(*args) ⇒ Parser
constructor
A new instance of Parser.
- #load(*args) ⇒ Object
- #parse(source) ⇒ Object
- #read(*args) ⇒ Object
- #source(*args) ⇒ Object
Constructor Details
#initialize(*args) ⇒ Parser
Returns a new instance of Parser.
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/proxy_pac_rb/parser.rb', line 21 def initialize(*args) if args.first.is_a? Hash @parser = ProxyPacParser.new(**args.first) else $stderr.puts 'Deprecated: Use of positional parameters. Please use named parameters: environment: Environment.new.' @parser = ProxyPacParser.new(environment: args.first) end @loader = ProxyPacLoader.new @linter = ProxyPacLinter.new end |
Instance Method Details
#load(*args) ⇒ Object
43 44 45 46 47 |
# File 'lib/proxy_pac_rb/parser.rb', line 43 def load(*args) $stderr.puts 'Deprecated: #load. Please use #parse instead.' parse(*args) end |
#parse(source) ⇒ Object
33 34 35 36 37 38 39 40 41 |
# File 'lib/proxy_pac_rb/parser.rb', line 33 def parse(source) pac_file = ProxyPacFile.new source: source loader.load(pac_file) linter.lint(pac_file) parser.parse(pac_file) pac_file end |
#read(*args) ⇒ Object
49 50 51 52 53 |
# File 'lib/proxy_pac_rb/parser.rb', line 49 def read(*args) $stderr.puts 'Deprecated: #read. Please use #parse instead.' parse(*args) end |
#source(*args) ⇒ Object
55 56 57 58 59 |
# File 'lib/proxy_pac_rb/parser.rb', line 55 def source(*args) $stderr.puts 'Deprecated: #source. Please use #parse instead.' parse(*args) end |