Class: Chid::Commands::Currency::Current
Constant Summary
Chid::Command::COMMANDS
Instance Attribute Summary
#options
Instance Method Summary
collapse
command, help, #initialize, map_options_with_values, run
Constructor Details
This class inherits a constructor from Chid::Command
Instance Method Details
#from ⇒ Object
40
41
42
|
# File 'lib/chid/commands/currency/now.rb', line 40
def from
options['-from']&.compact&.join || 'USD'
end
|
#run ⇒ Object
31
32
33
34
|
# File 'lib/chid/commands/currency/now.rb', line 31
def run
currency = CurrencyApi.convert(to: to, from: from)
puts "1 #{from} is #{currency} #{to}"
end
|
#to ⇒ Object
36
37
38
|
# File 'lib/chid/commands/currency/now.rb', line 36
def to
options['-to']&.compact&.join || 'BRL'
end
|