Class: GamesRadar::Genre
- Inherits:
-
Object
- Object
- GamesRadar::Genre
- Defined in:
- lib/games_radar/genre.rb
Constant Summary collapse
- GENRES =
{ "1" => :action, "2" => :fighting, "3" => :adventure, "4" => :arcade, "5" => :racing, "6" => :shooter, "7" => :flight, "8" => :strategy, "9" => :rpg, "10" => :sports, "11" => :other, "12" => :family, "13" => :children, "14" => :puzzle, "15" => :simulation }
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
The genre id.
-
#name ⇒ Object
readonly
The genre name.
Instance Method Summary collapse
-
#initialize(id) ⇒ Genre
constructor
Set up genre attributes based on the specified id.
Constructor Details
#initialize(id) ⇒ Genre
Set up genre attributes based on the specified id. The available genres can be found on the GamesRadar::Genre::GENRES constant.
29 30 31 32 33 34 |
# File 'lib/games_radar/genre.rb', line 29 def initialize(id) @id = id.to_s @name = GENRES[@id] raise GamesRadar::UnknownGenreError unless name end |
Instance Attribute Details
#id ⇒ Object (readonly)
The genre id
22 23 24 |
# File 'lib/games_radar/genre.rb', line 22 def id @id end |
#name ⇒ Object (readonly)
The genre name
25 26 27 |
# File 'lib/games_radar/genre.rb', line 25 def name @name end |