Class: Parker::Platform::Base
- Inherits:
-
Object
- Object
- Parker::Platform::Base
- Defined in:
- lib/parker/platform/base.rb
Overview
A base class for all platforms.
Instance Attribute Summary collapse
-
#games ⇒ Object
Returns the value of attribute games.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#source_path ⇒ Object
readonly
Returns the value of attribute source_path.
Instance Method Summary collapse
-
#initialize(name, source_path, game_data) ⇒ Base
constructor
A new instance of Base.
- #scan_games ⇒ Object
Constructor Details
#initialize(name, source_path, game_data) ⇒ Base
Returns a new instance of Base.
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/parker/platform/base.rb', line 10 def initialize(name, source_path, game_data) @name = name || self.class.name.split('::').last @source_path = File.(source_path) @games = {} game_data&.map do |game_identifier, game_name| @games[game_identifier] = Game.new(game_identifier, game_name) end scan_games if Dir.exist?(@source_path) end |
Instance Attribute Details
#games ⇒ Object
Returns the value of attribute games.
8 9 10 |
# File 'lib/parker/platform/base.rb', line 8 def games @games end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/parker/platform/base.rb', line 7 def name @name end |
#source_path ⇒ Object (readonly)
Returns the value of attribute source_path.
7 8 9 |
# File 'lib/parker/platform/base.rb', line 7 def source_path @source_path end |
Instance Method Details
#scan_games ⇒ Object
22 23 24 |
# File 'lib/parker/platform/base.rb', line 22 def scan_games raise 'Must be implemented by a subclass' end |