Class: Game
- Inherits:
-
Object
- Object
- Game
- Defined in:
- lib/game_gem/game.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#price ⇒ Object
Returns the value of attribute price.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Game
constructor
A new instance of Game.
Constructor Details
#initialize(attributes) ⇒ Game
Returns a new instance of Game.
6 7 8 |
# File 'lib/game_gem/game.rb', line 6 def initialize(attributes) attributes.each { |key, value| self.send("#{key}=", value) } end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/game_gem/game.rb', line 2 def name @name end |
#price ⇒ Object
Returns the value of attribute price.
2 3 4 |
# File 'lib/game_gem/game.rb', line 2 def price @price end |
Class Method Details
.all ⇒ Object
14 15 16 |
# File 'lib/game_gem/game.rb', line 14 def self.all @@all end |
.mass_create(games) ⇒ Object
10 11 12 |
# File 'lib/game_gem/game.rb', line 10 def self.mass_create(games) games.each { |game| @@all << Game.new(game) if !game[:name].empty? } end |