module ZTK::Command::Private

Command Private Functionality

Public Instance Methods

log_header(what, char="=") click to toggle source

Formats a header suitable for writing to the direct logger when logging sessions.

# File lib/ztk/command/private.rb, line 16
def log_header(what, char="=")
  count = 16
  sep = (char * count)
  header = [sep, "[ #{tag} >>> #{what} ]", sep].join
  "#{header}\n"
end
tag() click to toggle source

Returns a string in the format of “user@hostname” for the current shell.

# File lib/ztk/command/private.rb, line 9
def tag
  @@hostname ||= Socket.gethostname.split('.').first.strip
  "#{ENV['USER']}@#{@@hostname}"
end