Class: Inspec::Resources::ChronyConf
- Inherits:
-
Object
- Object
- Inspec::Resources::ChronyConf
- Includes:
- FileReader
- Defined in:
- lib/inspec/resources/chrony_conf.rb
Instance Method Summary collapse
-
#initialize(path = nil) ⇒ ChronyConf
constructor
A new instance of ChronyConf.
- #method_missing(name) ⇒ Object
- #to_s ⇒ Object
Methods included from FileReader
Constructor Details
#initialize(path = nil) ⇒ ChronyConf
Returns a new instance of ChronyConf.
24 25 26 27 |
# File 'lib/inspec/resources/chrony_conf.rb', line 24 def initialize(path = nil) @conf_path = path || "/etc/chrony.conf" @content = read_file_content(@conf_path) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/inspec/resources/chrony_conf.rb', line 29 def method_missing(name) param = read_params[name.to_s] # extract first value if we have only one value in array return param[0] if param.is_a?(Array) && (param.length == 1) param end |
Instance Method Details
#to_s ⇒ Object
37 38 39 |
# File 'lib/inspec/resources/chrony_conf.rb', line 37 def to_s "chrony.conf" end |