Class: EtcHosts
- Inherits:
-
Object
- Object
- EtcHosts
- Includes:
- CommentParser, FileReader
- Defined in:
- lib/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.
Methods included from FileReader
Methods included from CommentParser
Constructor Details
#initialize(hosts_path = nil) ⇒ EtcHosts
Returns a new instance of EtcHosts.
29 30 31 32 33 |
# File 'lib/resources/etc_hosts.rb', line 29 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.
21 22 23 |
# File 'lib/resources/etc_hosts.rb', line 21 def params @params end |