Class: Puppet::Parser::ParserFactory
- Defined in:
- lib/puppet/parser/parser_factory.rb
Overview
The ParserFactory makes selection of parser possible. Currently, it is possible to switch between two different parsers:
-
classic_parser, the parser in 3.1
-
eparser, the Expression Based Parser
Class Method Summary collapse
-
.classic_parser(environment) ⇒ Object
Creates an instance of the classic parser.
-
.eparser(environment) ⇒ Object
Creates an instance of the expression based parser ‘eparser’.
-
.parser(environment) ⇒ Object
Produces a parser instance for the given environment.
Class Method Details
.classic_parser(environment) ⇒ Object
Creates an instance of the classic parser.
22 23 24 25 |
# File 'lib/puppet/parser/parser_factory.rb', line 22 def self.classic_parser(environment) require 'puppet/parser' Puppet::Parser::Parser.new(environment) end |
.eparser(environment) ⇒ Object
Creates an instance of the expression based parser ‘eparser’
29 30 31 32 33 34 35 36 37 |
# File 'lib/puppet/parser/parser_factory.rb', line 29 def self.eparser(environment) # Since RGen is optional, test that it is installed @@asserted ||= false assert_rgen_installed() unless @@asserted @@asserted = true require 'puppet/parser' require 'puppet/parser/e_parser_adapter' EParserAdapter.new(Puppet::Parser::Parser.new(environment)) end |
.parser(environment) ⇒ Object
Produces a parser instance for the given environment
11 12 13 14 15 16 17 18 |
# File 'lib/puppet/parser/parser_factory.rb', line 11 def self.parser(environment) case Puppet[:parser] when 'future' eparser(environment) else classic_parser(environment) end end |