Top Level Namespace

Includes:
Universa

Defined Under Namespace

Modules: Universa Classes: Hash, KeyTool, MessageException, UBox, USettings

Constant Summary

Constants included from Universa

Universa::ALNUMS, Universa::NUMBERS, Universa::VERSION

Instance Method Summary collapse

Methods included from Universa

#derive_key, #retry_with_timeout

Instance Method Details

#error(message) ⇒ Object

Raises:



12
13
14
# File 'lib/universa/keytool/keytool.rb', line 12

def error message
  raise MessageException, message
end

#human_to_i(value, factor = 1000) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# 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) ⇒ Object



32
33
34
35
36
# 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