Class: Inspec::Resources::EtcHosts
- Inherits:
-
Object
- Object
- Inspec::Resources::EtcHosts
- Includes:
- FileReader, Utils::CommentParser
- Defined in:
- lib/inspec/resources/etc_hosts.rb
Constant Summary collapse
- DEFAULT_UNIX_PATH =
"/etc/hosts".freeze
- DEFAULT_WINDOWS_PATH =
'C:\windows\system32\drivers\etc\hosts'.freeze
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(hosts_path = nil) ⇒ EtcHosts
constructor
A new instance of EtcHosts.
- #to_s ⇒ Object
Methods included from FileReader
Methods included from Utils::CommentParser
Constructor Details
#initialize(hosts_path = nil) ⇒ EtcHosts
Returns a new instance of EtcHosts.
27 28 29 30 31 |
# File 'lib/inspec/resources/etc_hosts.rb', line 27 def initialize(hosts_path = nil) content = read_file_content(hosts_path || default_hosts_file_path) @params = parse_conf(content.lines) end |
Instance Attribute Details
#params ⇒ Object (readonly)
Returns the value of attribute params.
19 20 21 |
# File 'lib/inspec/resources/etc_hosts.rb', line 19 def params @params end |
Instance Method Details
#to_s ⇒ Object
39 40 41 |
# File 'lib/inspec/resources/etc_hosts.rb', line 39 def to_s "Hosts File" end |