Class: GameScraper
- Inherits:
-
Object
- Object
- GameScraper
- Defined in:
- lib/game_gem/gamescraper.rb
Instance Method Summary collapse
-
#initialize ⇒ GameScraper
constructor
A new instance of GameScraper.
- #run ⇒ Object
Constructor Details
#initialize ⇒ GameScraper
Returns a new instance of GameScraper.
3 4 5 6 |
# File 'lib/game_gem/gamescraper.rb', line 3 def initialize @html = Nokogiri::HTML(open("http://store.steampowered.com/")) @games_html = @html.css("#tab_topsellers_content a") end |
Instance Method Details
#run ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/game_gem/gamescraper.rb', line 8 def run @games_html.map do |game| fields = {} fields[:name] = game.css(".tab_item_name").text fields[:price] = game.css(".discount_final_price").text fields end end |