Class: Bandit::Config
- Inherits:
-
Object
- Object
- Bandit::Config
- Defined in:
- lib/bandit/config.rb
Instance Attribute Summary collapse
-
#player ⇒ Object
player should be name of player.
-
#player_config ⇒ Object
player_config should be hash of player config values.
-
#storage ⇒ Object
storage should be name of storage engine.
-
#storage_config ⇒ Object
storage_config should be hash of storage config values.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#player ⇒ Object
player should be name of player
15 16 17 |
# File 'lib/bandit/config.rb', line 15 def player @player end |
#player_config ⇒ Object
player_config should be hash of player config values
18 19 20 |
# File 'lib/bandit/config.rb', line 18 def player_config @player_config end |
#storage ⇒ Object
storage should be name of storage engine
9 10 11 |
# File 'lib/bandit/config.rb', line 9 def storage @storage end |
#storage_config ⇒ Object
storage_config should be hash of storage config values
12 13 14 |
# File 'lib/bandit/config.rb', line 12 def storage_config @storage_config end |
Class Method Details
.required_fields ⇒ Object
4 5 6 |
# File 'lib/bandit/config.rb', line 4 def self.required_fields [:storage, :player] end |
Instance Method Details
#check! ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bandit/config.rb', line 20 def check! self.class.required_fields.each do |required_field| unless send(required_field) raise MissingConfigurationError, "#{required_field} must be set" end end @storage_config ||= {} @player_config ||= {} end |