class Cryptonewbie::Scraper

Public Instance Methods

get_cryptos() click to toggle source
# File lib/cryptonewbie/scraper.rb, line 7
def get_cryptos
  table = self.get_page.at('table#currencies')
  content = table.css('tbody')
  rows = content.css('tr')
end
get_page() click to toggle source
# File lib/cryptonewbie/scraper.rb, line 3
def get_page
  Nokogiri::HTML(open("https://coinmarketcap.com"))
end
make_cryptos() click to toggle source
# File lib/cryptonewbie/scraper.rb, line 13
def make_cryptos
  self.get_cryptos.collect do |coin|
    if coin.css('td.text-center').text.strip.to_i < 6
      Cryptonewbie::Crypto.new_from_index_page(coin)
    end
  end.compact
end