Class: StoryTeller::Game
- Defined in:
- lib/story_teller/game/loader.rb
Overview
The Game class
Defined Under Namespace
Modules: Loader Classes: GameLoadError
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#config_file_path ⇒ Object
readonly
Returns the value of attribute config_file_path.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #environment ⇒ Object
- #environment=(env) ⇒ Object
-
#initialize(options) ⇒ Game
constructor
A new instance of Game.
- #name ⇒ Object
Constructor Details
#initialize(options) ⇒ Game
Returns a new instance of Game.
30 31 32 33 34 35 36 |
# File 'lib/story_teller/game/loader.rb', line 30 def initialize() @config = {} @path, @file_path = game_paths() @config_file_path = File.join(@path, [:game_config_file_name]) @config = YAML.load_file(@config_file_path, symbolize_names: true) @config[:game_file_path] = @file_path unless @file_path.nil? end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
28 29 30 |
# File 'lib/story_teller/game/loader.rb', line 28 def config @config end |
#config_file_path ⇒ Object (readonly)
Returns the value of attribute config_file_path.
28 29 30 |
# File 'lib/story_teller/game/loader.rb', line 28 def config_file_path @config_file_path end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
28 29 30 |
# File 'lib/story_teller/game/loader.rb', line 28 def file_path @file_path end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
28 29 30 |
# File 'lib/story_teller/game/loader.rb', line 28 def path @path end |
Instance Method Details
#environment ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/story_teller/game/loader.rb', line 42 def environment ( ENV['GAME_ENVIRONMENT'] || @config[:environment] || StoryTeller::Engine.default_environment ).to_sym end |
#environment=(env) ⇒ Object
50 51 52 |
# File 'lib/story_teller/game/loader.rb', line 50 def environment=(env) @config[:environment] = env.to_sym end |
#name ⇒ Object
38 39 40 |
# File 'lib/story_teller/game/loader.rb', line 38 def name @config[:game_name] end |