class StocksInfo::Ticker
Attributes
html[RW]
links[RW]
name[RW]
news[RW]
price[RW]
price_change[RW]
url[RW]
Public Class Methods
new(ticker)
click to toggle source
# File lib/stocks-info/ticker.rb, line 5 def initialize(ticker) @url = "https://finance.yahoo.com/quote/#{ticker.upcase}" @links = [] end
valid_ticker?(ticker)
click to toggle source
# File lib/stocks-info/ticker.rb, line 10 def self.valid_ticker?(ticker) html = Nokogiri::HTML(open(self.new(ticker).url)) if html.css("#quote-header-info h1").text == "" false else true end end