class SmartAlec::Robot

Public Instance Methods

do_task(command, option=nil) click to toggle source
# File lib/smart_alec.rb, line 8
def do_task(command, option=nil)
  if command == "time"
    puts "The date and time currently is: " + SmartAlec::CurrentTime.new.get
  elsif command == "weather"
    weather = SmartAlec::Weather.new(option)
    puts "The current temperature in #{option.capitalize} is #{weather.fahrenheit} degrees fahrenheit."
  elsif command == "stock"
    stock = SmartAlec::Stock.new(option)
    puts "The realtime bid for #{option.upcase} is $#{stock.current_price}."
  else
    puts "Alec doesn't understand that command."
  end
end