Class: Mnemonicker::Commands::Encode

Inherits:
Object
  • Object
show all
Defined in:
lib/mnemonicker/cli.rb

Instance Method Summary collapse

Instance Method Details

#process(number) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/mnemonicker/cli.rb', line 33

def process(number)
  tried = false
  list = WordList.new('cli')
  wordlist = begin
    list.fetch
  rescue WordList::ListNotFound
    if tried
      raise
    else
      tried = true
      $stderr.puts "No word list found, downloading..."
      list.update
      retry
    end
  end

  candidates = wordlist['words'][number]

  puts candidates.sort if candidates
  true
end