class Object

Public Instance Methods

error(message) click to toggle source
# File lib/universa/keytool/keytool.rb, line 12
def error message
  raise MessageException, message
end
human_to_i(value, factor = 1000) click to toggle source
# File lib/universa/keytool/keytool.rb, line 18
def human_to_i value, factor = 1000
  head, tail = value[0...-1], value[-1]
  case tail
    when 'k', 'K'
      head.to_i * 1000
    when 'M', 'm'
      head.to_i * factor * factor
    when 'G', 'g'
      head.to_i * factor * factor * factor
    else
      value.to_t
  end
end
seconds_to_hms(seconds) click to toggle source
# File lib/universa/keytool/keytool.rb, line 32
def seconds_to_hms seconds
  mm, ss = seconds.divmod(60)
  hh, mm = mm.divmod(60)
  "%d:%02d:%02d" % [hh, mm, ss]
end