Class: StoryTeller::Application
- Defined in:
- lib/story_teller/application.rb
Overview
The Application class is the host composition root for a StoryTeller runtime.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#runtime ⇒ Object
readonly
Returns the value of attribute runtime.
Instance Method Summary collapse
-
#initialize(options = StoryTeller::Config.defaults) ⇒ Application
constructor
A new instance of Application.
- #load_game ⇒ Object
- #play_game ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(options = StoryTeller::Config.defaults) ⇒ Application
Returns a new instance of Application.
28 29 30 31 32 33 |
# File 'lib/story_teller/application.rb', line 28 def initialize( = StoryTeller::Config.defaults) @options = configure_engine configure_context @runtime = StoryTeller::Runtime.instance(@options) end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
26 27 28 |
# File 'lib/story_teller/application.rb', line 26 def @options end |
#runtime ⇒ Object (readonly)
Returns the value of attribute runtime.
26 27 28 |
# File 'lib/story_teller/application.rb', line 26 def runtime @runtime end |
Instance Method Details
#load_game ⇒ Object
35 36 37 38 |
# File 'lib/story_teller/application.rb', line 35 def load_game runtime.persistence.reset! if [:reset_db_each_session] runtime.load_game end |
#play_game ⇒ Object
40 41 42 43 |
# File 'lib/story_teller/application.rb', line 40 def play_game runtime.manage_privileges runtime.play_game end |
#run ⇒ Object
45 46 47 48 |
# File 'lib/story_teller/application.rb', line 45 def run load_game play_game end |