Class: MoneyExchange::Command
- Inherits:
-
Thor
- Object
- Thor
- MoneyExchange::Command
- Defined in:
- lib/money_exchange/command.rb
Instance Method Summary collapse
Instance Method Details
#banner ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/money_exchange/command.rb', line 38 def = ~<<-EOS Available currency codes: AUD: Australian dollar CAD: Canadian dollar CHF: Swiss franc CNY: Chinese yuan DKK: Danish krone EUR: Euro GBP: British pound HKD: Hong Kong dollar HUF: Hungarian forint INR: Indian rupee JPY: Japanese yen MXN: Mexican peso NOK: Norwegian krone NZD: New Zealand dollar PLN: Polish złoty SEK: Swedish krona SGD: Singapore dollar TRY: Turkish lira USD: United States Dollar ZAR: South African rand EOS help puts end |
#ex(amount, base, *targets) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/money_exchange/command.rb', line 6 def ex(amount, base, *targets) results = amount.send("#{base.downcase}_to", *targets.map(&:downcase)) print_in_format(amount, base, targets, results) rescue Exchange::NoCurrencyDataError abort "no exchange data for any of them. see help." rescue abort "you might pass wrong codes. see help." end |
#version ⇒ Object
32 33 34 |
# File 'lib/money_exchange/command.rb', line 32 def version puts "MoneyExchange #{MoneyExchange::VERSION} (c) 2013 kyoendo" end |