Module: StoryTeller::ClassMethods

Included in:
Runtime
Defined in:
lib/story_teller/runtime.rb

Overview

module ClassMethods

Instance Method Summary collapse

Instance Method Details

#game_saves_dir_pathObject



350
351
352
353
354
# File 'lib/story_teller/runtime.rb', line 350

def game_saves_dir_path
  File.join(
    StoryTeller::Runtime.project_dir_path,
    '.' + StoryTeller::Game.config[:game_name] + '_saves')
end

#instance(options = nil) ⇒ Object



356
357
358
359
# File 'lib/story_teller/runtime.rb', line 356

def instance(options = nil)
  @instance ||= new(StoryTeller::Config.defaults)
  @instance.tap { |obj| obj.configure!(options) unless options.nil? }
end

#project_dir_pathObject



342
343
344
345
346
347
348
# File 'lib/story_teller/runtime.rb', line 342

def project_dir_path
  @project_dir_path ||= begin
    story_dir_path = File.expand_path(__dir__)
    lib_dir_path = File.expand_path(File.dirname(story_dir_path))
    File.expand_path(File.dirname(lib_dir_path))
  end
end