class EnhancedPrompt::Prompt::Token

Responsible for delegating instructions to proper instance. And convert into proper string after receiving Integer, AddrInfo or something else

Public Instance Methods

dir_abbreviated1(limit=40) click to toggle source

Delegating to Dir resources

# File lib/enhanced_prompt/token/token.rb, line 89
def dir_abbreviated1(limit=40)
  _dir.dir_abbreviated1(limit).to_s || ""
end
dir_full() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 93
def dir_full
  _dir.dir_full.to_s
end
gid() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 84
def gid
  _user.gid.to_s || "No #{__method__}"
end
git() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 97
def git
  _git.git
end
global_ipv4() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 18
def global_ipv4
  _network.global_ipv4 ? _network.global_ipv4.inspect_sockaddr : ''
end
global_ipv6() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 22
def global_ipv6
  _network.global_ipv6 ? _network.global_ipv6.inspect_sockaddr : ''
end
groupname() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 39
def groupname
  _user.groupname || ''
end
hostname() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 30
def hostname
  _network.hostname || ''
end
hostname_full() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 26
def hostname_full
  _network.hostname_full || ''
end
ipv4() click to toggle source

Delegating to Network resource

# File lib/enhanced_prompt/token/token.rb, line 10
def ipv4
  _network.ipv4 ? _network.ipv4.inspect_sockaddr : ''
end
ipv6() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 14
def ipv6
  _network.ipv6 ? _network.ipv6.inspect_sockaddr : ''
end
login_count() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 68
def login_count
  _user.login_count.to_s
end
my_login_count() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 72
def my_login_count
  _user.my_login_count.to_s
end
other_login_count() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 76
def other_login_count
  _user.other_login_count.to_s
end
other_user_names() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 47
def other_user_names
  _user.other_usernames.join(',')
end
other_user_names_if_exists() click to toggle source
# 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() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 64
def other_users_count
  _user.other_users_count.to_s
end
time1() click to toggle source

Delegating to Time resources

# File lib/enhanced_prompt/token/token.rb, line 103
def time1
  _time.time1.to_s
end
uid() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 80
def uid
  _user.uid.to_s || "No #{__method__}"
end
username() click to toggle source

Delegating to User resource

# File lib/enhanced_prompt/token/token.rb, line 35
def username
  _user.username || ''
end
usernames() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 43
def usernames
  _user.usernames.join(',')
end
users_count() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 55
def users_count
  _user.users_count.to_s
end
users_count_scale1() click to toggle source

TODO : should be method missing to ***_scale

# File lib/enhanced_prompt/token/token.rb, line 60
def users_count_scale1
  vertical_bar_scale(_user.users_count)
end

Private Instance Methods

_dir() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 120
def _dir
  @_dir ||= Dir.new
end
_git() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 108
def _git
  @_git ||= Git.new(_dir.dir_full)
end
_network() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 112
def _network
  @_network ||= Network.new
end
_time() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 124
def _time
  @_time ||= Time.new
end
_user() click to toggle source
# File lib/enhanced_prompt/token/token.rb, line 116
def _user
  @_user ||= User.new
end
method_missing(name,*args) click to toggle source
Calls superclass method
# File lib/enhanced_prompt/token/token.rb, line 128
def method_missing(name,*args)
  puts "No such token. "
  raise super
end