Method: LinuxStat::User.home_directories
- Defined in:
- lib/linux_stat/user.rb
.home_directories ⇒ Object
Returns all the home directories as Hash.
For example:
LinuxStat::User.home_directories
=> {:root=>"/root", :bin=>"/", :daemon=>"/", :mail=>"/var/spool/mail", :ftp=>"/srv/ftp", :http=>"/srv/http", :nobody=>"/"}
But if the status isn’t available it will return an empty Hash.
75 76 77 78 79 80 81 |
# File 'lib/linux_stat/user.rb', line 75 def home_directories return {} unless passwd_readable? passwd.reduce({}) { |h, x| splitted = x.split(?:) h.merge!(splitted[0].to_sym => splitted[5]) } end |