Class: Inspec::Resources::NtpConf
- Inherits:
-
Object
- Object
- Inspec::Resources::NtpConf
- Includes:
- FileReader
- Defined in:
- lib/inspec/resources/ntp_conf.rb
Instance Method Summary collapse
-
#initialize(path = nil) ⇒ NtpConf
constructor
A new instance of NtpConf.
- #method_missing(name) ⇒ Object
- #to_s ⇒ Object
Methods included from FileReader
Constructor Details
#initialize(path = nil) ⇒ NtpConf
Returns a new instance of NtpConf.
20 21 22 23 |
# File 'lib/inspec/resources/ntp_conf.rb', line 20 def initialize(path = nil) @conf_path = path || "/etc/ntp.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
25 26 27 28 29 30 31 |
# File 'lib/inspec/resources/ntp_conf.rb', line 25 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
33 34 35 |
# File 'lib/inspec/resources/ntp_conf.rb', line 33 def to_s "ntp.conf" end |