Module: StoryTeller::PersistedStartupLocation

Defined in:
lib/story_teller/player_character.rb

Overview

module PersistedStartupLocation

Constant Summary collapse

Key =
:story_teller_persisted_startup_location

Class Method Summary collapse

Class Method Details

.clearObject



71
72
73
# File 'lib/story_teller/player_character.rb', line 71

def clear
  Thread.current[Key] = nil
end

.peekObject



67
68
69
# File 'lib/story_teller/player_character.rb', line 67

def peek
  Thread.current[Key]
end

.with(location) ⇒ Object



59
60
61
62
63
64
65
# File 'lib/story_teller/player_character.rb', line 59

def with(location)
  previous = Thread.current[Key]
  Thread.current[Key] = location
  yield
ensure
  Thread.current[Key] = previous
end