Sha256: f2b7c1a99f97f54fc96a4359e350819f3802825d111308e8a76877fbb1448b3b

Contents?: true

Size: 717 Bytes

Versions: 1

Compression:

Stored size: 717 Bytes

Contents

class StockGains::StockLookup
  attr_accessor :tickers

  def initialize
    @tickers = []
  end

  def call
    input = "" 
    loop do
      puts "Enter the stock ticker(s) of any stock you'd like to view."
      puts "Separated stock tickers with a space.\n\n"
      input = gets.strip.downcase
      break if input == "e" || input == ""
      tickers << input.strip.scan(/\S[a-zA-Z]+/).join("+").upcase
      StockGains::CLI.new.print_stock_info(retrieve_stock_info(tickers))
      tickers.clear
    end
  end

  def retrieve_stock_info(tickers)
    StockGains::Stock.retrieve_stock(tickers).collect do |s|
      StockGains::Stock.new(s[0], s[1], s[2], s[3], s[4], s[5], s[6], s[7], s[8], s[9])
    end
  end
end 

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stock-gains-0.1.7 lib/stock-gains/stock_lookup.rb