Class: Inspec::Resources::PostfixConf
- Inherits:
-
IniConfig
- Object
- JsonConfig
- IniConfig
- Inspec::Resources::PostfixConf
- Defined in:
- lib/inspec/resources/postfix_conf.rb
Instance Attribute Summary
Attributes inherited from JsonConfig
Instance Method Summary collapse
-
#initialize(*opts) ⇒ PostfixConf
constructor
Allow user to specify a custom configuration path, use default Postfix configuration path if no custom path is provided.
- #parse(content) ⇒ Object
- #to_s ⇒ Object
Methods inherited from JsonConfig
Methods included from FileReader
Methods included from ObjectTraverser
Constructor Details
#initialize(*opts) ⇒ PostfixConf
Allow user to specify a custom configuration path, use default Postfix configuration path if no custom path is provided
11 12 13 14 15 16 17 18 19 |
# File 'lib/inspec/resources/postfix_conf.rb', line 11 def initialize(*opts) @params = {} if opts.length == 1 @raw_content = load_raw_content(opts[0]) else @raw_content = load_raw_content("/etc/postfix/main.cf") end @params = parse(@raw_content) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Inspec::Resources::JsonConfig
Instance Method Details
#parse(content) ⇒ Object
21 22 23 |
# File 'lib/inspec/resources/postfix_conf.rb', line 21 def parse(content) SimpleConfig.new(content).params end |
#to_s ⇒ Object
25 26 27 |
# File 'lib/inspec/resources/postfix_conf.rb', line 25 def to_s "Postfix Mail Transfer Agent" end |