Class: Snackhack2::ListUsers
- Inherits:
-
Object
- Object
- Snackhack2::ListUsers
- Defined in:
- lib/snackhack2/list_users.rb
Instance Attribute Summary collapse
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize ⇒ ListUsers
constructor
A new instance of ListUsers.
- #linux ⇒ Object
- #windows ⇒ Object
- #windows_search_user ⇒ Object
Constructor Details
#initialize ⇒ ListUsers
Returns a new instance of ListUsers.
5 6 7 |
# File 'lib/snackhack2/list_users.rb', line 5 def initialize @user = user end |
Instance Attribute Details
#user ⇒ Object
Returns the value of attribute user.
3 4 5 |
# File 'lib/snackhack2/list_users.rb', line 3 def user @user end |
Instance Method Details
#linux ⇒ Object
9 10 11 12 13 |
# File 'lib/snackhack2/list_users.rb', line 9 def linux `cat /etc/passwd`.split("\n").each do |l| puts l.split(":")[0] end end |
#windows ⇒ Object
15 16 17 |
# File 'lib/snackhack2/list_users.rb', line 15 def windows puts `net users` end |
#windows_search_user ⇒ Object
19 20 21 |
# File 'lib/snackhack2/list_users.rb', line 19 def windows_search_user puts `net user #{@user}` end |