module Richard::QueuedUserFormatter

Public Instance Methods

format_duration(duration) click to toggle source
# File lib/richard/queued_user_formatter.rb, line 35
def format_duration(duration)
  (duration) ? Time.at(duration).utc.strftime("%Hh %Mm %Ss") : '--'
end
row_header() click to toggle source
# File lib/richard/queued_user_formatter.rb, line 17
def row_header
  [
    "User Id",
    "User",
    "Status",
    "Blocking Duration"
  ]
end
table_format(users) click to toggle source
# File lib/richard/queued_user_formatter.rb, line 7
def table_format(users)
  # return Terminal::Table.new(rows: rows)
  Terminal::Table.new do |table|
    table << row_header
    table.add_separator

    users.each { |user| table << user_to_row(user) }
  end
end
user_to_row(user) click to toggle source
# File lib/richard/queued_user_formatter.rb, line 26
def user_to_row(user)
  return [
    user.user_id,
    user.email,
    user.status,
    format_duration(user.blocking_duration)
  ]
end