Class: GamesRadar::Platform
- Inherits:
-
Object
- Object
- GamesRadar::Platform
- Defined in:
- lib/games_radar/platform.rb
Constant Summary collapse
- PLATFORMS =
{ "1" => ["XBox", :xbox], "2" => ["PlayStation 2", :ps2], "3" => ["Game Boy", :gameboy], "4" => ["PC", :pc], "5" => ["PlayStation 3", :ps3], "6" => ["PSP", :psp], "7" => ["XBox 360", :xbox360], "8" => ["GameCube", :gc], "9" => ["Nintendo DS", :ds], "11" => ["Wii", :wii], "12" => ["Nintendo", :nes], "13" => ["Super Nintendo", :snes], "14" => ["Genesis", :genesis], "15" => ["Saturn", :saturn], "2005120714112598110961" => ["Game Boy Advanced", :gba], "2005120714112685461425" => ["PlayStation", :ps1], "2005120714112722229003" => ["Nintendo 64", :n64], "2005120714112823431396" => ["Dreamcast", :dc] }
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
The platform code.
-
#id ⇒ Object
readonly
The platform id.
-
#name ⇒ Object
readonly
The platform name.
Instance Method Summary collapse
-
#initialize(id) ⇒ Platform
constructor
Set up platform attributes based on the specified id.
Constructor Details
#initialize(id) ⇒ Platform
Set up platform attributes based on the specified id. The available platforms can be found on the GamesRadar::Platform::PLATFORMS constant.
35 36 37 38 39 |
# File 'lib/games_radar/platform.rb', line 35 def initialize(id) @id = id.to_s raise GamesRadar::UnknownPlatformError unless PLATFORMS[@id] @name, @code = PLATFORMS[@id] end |
Instance Attribute Details
#code ⇒ Object (readonly)
The platform code
31 32 33 |
# File 'lib/games_radar/platform.rb', line 31 def code @code end |
#id ⇒ Object (readonly)
The platform id
25 26 27 |
# File 'lib/games_radar/platform.rb', line 25 def id @id end |
#name ⇒ Object (readonly)
The platform name
28 29 30 |
# File 'lib/games_radar/platform.rb', line 28 def name @name end |