Class: NATOPhone::NATOPhoneCLI

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

Instance Method Summary collapse

Instance Method Details

#decode(*args) ⇒ Object



28
29
30
31
32
33
34
35
36
37
# File 'lib/cli.rb', line 28

def decode(*args)
  dec = NATOPhone::Decoder.new(args)
  if options[:yell]
    puts "\n#{dec.yell}\n\n"
  elsif options[:json]
    puts dec.to_json
  else
    puts "\n#{dec}\n\n"
  end
end

#encode(*args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/cli.rb', line 13

def encode(*args)
  enc = NATOPhone::Encoder.new(args)
  if options[:yell]
    puts "\n#{enc.yell}\n\n"
  elsif options[:json]
    puts enc.to_json
  else
    puts "\n#{enc}\n\n"
  end
end