Class: EnhancedPrompt::Prompt::Token
- Inherits:
-
Object
- Object
- EnhancedPrompt::Prompt::Token
show all
- Includes:
- EmojiWritable
- Defined in:
- lib/enhanced_prompt/token/token.rb,
lib/enhanced_prompt/token/dir.rb,
lib/enhanced_prompt/token/dir.rb,
lib/enhanced_prompt/token/time.rb
Overview
Responsible for delegating instructions to proper instance. And convert into proper string after receiving Integer, AddrInfo or something else
Defined Under Namespace
Classes: Dir, Git, Network, SystemResource, Time, User
Instance Method Summary
collapse
#vertical_bar_scale
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
128
129
130
131
|
# File 'lib/enhanced_prompt/token/token.rb', line 128
def method_missing(name,*args)
puts "No such token. "
raise super
end
|
Instance Method Details
#dir_abbreviated1(limit = 40) ⇒ Object
Delegating to Dir resources
89
90
91
|
# File 'lib/enhanced_prompt/token/token.rb', line 89
def dir_abbreviated1(limit=40)
_dir.dir_abbreviated1(limit).to_s || ""
end
|
#dir_full ⇒ Object
93
94
95
|
# File 'lib/enhanced_prompt/token/token.rb', line 93
def dir_full
_dir.dir_full.to_s
end
|
#gid ⇒ Object
84
85
86
|
# File 'lib/enhanced_prompt/token/token.rb', line 84
def gid
_user.gid.to_s || "No #{__method__}"
end
|
#git ⇒ Object
97
98
99
|
# File 'lib/enhanced_prompt/token/token.rb', line 97
def git
_git.git
end
|
#global_ipv4 ⇒ Object
18
19
20
|
# File 'lib/enhanced_prompt/token/token.rb', line 18
def global_ipv4
_network.global_ipv4 ? _network.global_ipv4.inspect_sockaddr : ''
end
|
#global_ipv6 ⇒ Object
22
23
24
|
# File 'lib/enhanced_prompt/token/token.rb', line 22
def global_ipv6
_network.global_ipv6 ? _network.global_ipv6.inspect_sockaddr : ''
end
|
#groupname ⇒ Object
39
40
41
|
# File 'lib/enhanced_prompt/token/token.rb', line 39
def groupname
_user.groupname || ''
end
|
#hostname ⇒ Object
30
31
32
|
# File 'lib/enhanced_prompt/token/token.rb', line 30
def hostname
_network.hostname || ''
end
|
#hostname_full ⇒ Object
26
27
28
|
# File 'lib/enhanced_prompt/token/token.rb', line 26
def hostname_full
_network.hostname_full || ''
end
|
#ipv4 ⇒ Object
Delegating to Network resource
10
11
12
|
# File 'lib/enhanced_prompt/token/token.rb', line 10
def ipv4
_network.ipv4 ? _network.ipv4.inspect_sockaddr : ''
end
|
#ipv6 ⇒ Object
14
15
16
|
# File 'lib/enhanced_prompt/token/token.rb', line 14
def ipv6
_network.ipv6 ? _network.ipv6.inspect_sockaddr : ''
end
|
#login_count ⇒ Object
68
69
70
|
# File 'lib/enhanced_prompt/token/token.rb', line 68
def login_count
_user.login_count.to_s
end
|
#my_login_count ⇒ Object
72
73
74
|
# File 'lib/enhanced_prompt/token/token.rb', line 72
def my_login_count
_user.my_login_count.to_s
end
|
#other_login_count ⇒ Object
76
77
78
|
# File 'lib/enhanced_prompt/token/token.rb', line 76
def other_login_count
_user.other_login_count.to_s
end
|
#other_user_names ⇒ Object
47
48
49
|
# File 'lib/enhanced_prompt/token/token.rb', line 47
def other_user_names
_user.other_usernames.join(',')
end
|
#other_user_names_if_exists ⇒ Object
51
52
53
|
# File 'lib/enhanced_prompt/token/token.rb', line 51
def other_user_names_if_exists
_user.other_users_count == 0 ? '' : _user.other_usernames.join(',')
end
|
#other_users_count ⇒ Object
64
65
66
|
# File 'lib/enhanced_prompt/token/token.rb', line 64
def other_users_count
_user.other_users_count.to_s
end
|
#time1 ⇒ Object
Delegating to Time resources
103
104
105
|
# File 'lib/enhanced_prompt/token/token.rb', line 103
def time1
_time.time1.to_s
end
|
#uid ⇒ Object
80
81
82
|
# File 'lib/enhanced_prompt/token/token.rb', line 80
def uid
_user.uid.to_s || "No #{__method__}"
end
|
#username ⇒ Object
Delegating to User resource
35
36
37
|
# File 'lib/enhanced_prompt/token/token.rb', line 35
def username
_user.username || ''
end
|
#usernames ⇒ Object
43
44
45
|
# File 'lib/enhanced_prompt/token/token.rb', line 43
def usernames
_user.usernames.join(',')
end
|
#users_count ⇒ Object
55
56
57
|
# File 'lib/enhanced_prompt/token/token.rb', line 55
def users_count
_user.users_count.to_s
end
|
#users_count_scale1 ⇒ Object
TODO : should be method missing to ***_scale
60
61
62
|
# File 'lib/enhanced_prompt/token/token.rb', line 60
def users_count_scale1
vertical_bar_scale(_user.users_count)
end
|