Class: BitConverter::CLI

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

Instance Method Summary collapse

Instance Method Details

#convert(amount, from, to) ⇒ Object



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

def convert(amount, from, to)
  puts BitConverter::Convert.pretty_convert(amount: amount.to_f,
                                            from: from,
                                            to: to)
rescue RuntimeError => e
  puts e.message
end

#pingObject



9
10
11
# File 'lib/bit_converter/cli.rb', line 9

def ping
  puts BitConverter::Ping.ping
end

#rate(from, to) ⇒ Object



23
24
25
# File 'lib/bit_converter/cli.rb', line 23

def rate(from, to)
  convert(1, from, to)
end