Method: Roma::KeyList#initialize

Defined in:
lib/roma/tools/key_list.rb

#initialize(strgpath, param_sleep) ⇒ KeyList

Returns a new instance of KeyList.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/roma/tools/key_list.rb', line 14

def initialize(strgpath, param_sleep)
  each_hash(strgpath){|hname, dir|
    STDERR.puts "### #{hname} #{dir}"
    st = open_storage(dir)

    c = 0
    n = st.true_length
    m = n / 100
    m = 1 if m < 1
    st.divnum.times{|i|
      st.each_hdb_dump(i){|data|
        c += 1
        STDERR.print "#{c}/#{n}\r" if c % m == 0
        vn, last, clk, expt, klen = data.unpack('NNNNN')
        key, = data[20..-1].unpack("a#{klen}")
        STDOUT.puts key
        sleep param_sleep
      }
    }

    st.closedb
    STDERR.puts "\ndone"
  }
end