Class: EnhancedPrompt::Prompt::Token::User

Inherits:
Object
  • Object
show all
Defined in:
lib/enhanced_prompt/token/user.rb

Instance Method Summary collapse

Instance Method Details

#gidObject



48
49
50
# File 'lib/enhanced_prompt/token/user.rb', line 48

def gid
  @gid = _passwd.gid
end

#groupnameObject



40
41
42
# File 'lib/enhanced_prompt/token/user.rb', line 40

def groupname
  @groupname = _group.name
end

#login_countObject



28
29
30
# File 'lib/enhanced_prompt/token/user.rb', line 28

def 
  @login_count ||= _user_list.size
end

#my_login_countObject



32
33
34
# File 'lib/enhanced_prompt/token/user.rb', line 32

def 
   ||= _user_list.count{|user| user == username}
end

#other_login_countObject



36
37
38
# File 'lib/enhanced_prompt/token/user.rb', line 36

def 
   ||=  - 
end

#other_usernamesObject



16
17
18
# File 'lib/enhanced_prompt/token/user.rb', line 16

def other_usernames
  @other_user_names ||= usernames - [username]
end

#other_users_countObject



24
25
26
# File 'lib/enhanced_prompt/token/user.rb', line 24

def other_users_count
  @other_users_count ||= users_count - 1
end

#uidObject



44
45
46
# File 'lib/enhanced_prompt/token/user.rb', line 44

def uid
  @uid = _passwd.uid
end

#usernameObject

Shows your username



7
8
9
# File 'lib/enhanced_prompt/token/user.rb', line 7

def username
  @username ||= ENV['USER'] || ENV['LOGNAME'] || Etc.getlogin
end

#usernamesObject

Shows usernames currently in your system



12
13
14
# File 'lib/enhanced_prompt/token/user.rb', line 12

def usernames
  @user_names ||= _user_list.uniq
end

#users_countObject



20
21
22
# File 'lib/enhanced_prompt/token/user.rb', line 20

def users_count
  @users_count ||= usernames.size
end