class UpcomingVideoGames::Game
Attributes
console[RW]
description[RW]
name[RW]
price[RW]
purchase_link[RW]
release_date[RW]
url[RW]
Public Class Methods
create_by_each_game(scraped_games)
click to toggle source
# File lib/upcoming_video_games/game.rb, line 12 def self.create_by_each_game(scraped_games) scraped_games.each do |game| #write a comment to explain release year self.new(game) unless game[:release_date] < (DateTime.now) rescue nil end end
games()
click to toggle source
# File lib/upcoming_video_games/game.rb, line 19 def self.games @@games.sort_by! {|game_obj| game_obj.release_date} end
new(game_hash)
click to toggle source
# File lib/upcoming_video_games/game.rb, line 6 def initialize(game_hash) game_hash.each {|key, value| self.send(("#{key}="), value)} @@games << self end
Public Instance Methods
add_game_details(details)
click to toggle source
# File lib/upcoming_video_games/game.rb, line 23 def add_game_details(details) details.each {|key, value| self.send(("#{key}="), value)} self end