Sha256: e99e3fd1dd218f0027047996a56785aa43e0693c501f9d52015779cc718e07e0

Contents?: true

Size: 303 Bytes

Versions: 5

Compression:

Stored size: 303 Bytes

Contents

class Game
  attr_accessor :name, :price

  @@all = []

  def initialize(attributes)
    attributes.each { |key, value| self.send("#{key}=", value) }
  end

  def self.mass_create(games)
    games.each { |game| @@all << Game.new(game) if !game[:name].empty? }
  end

  def self.all
    @@all
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
game_gem-0.5.0 lib/game_gem/game.rb
game_gem-0.4.0 lib/game_gem/game.rb
game_gem-0.3.0 lib/game_gem/game.rb
game_gem-0.2.0 lib/game_gem/game.rb
game_gem-0.1.0 lib/game_gem/game.rb