Module: Gamefic::Stage

Defined in:
lib/gamefic/stage.rb

Overview

A safe execution environment for narrative code.

Constant Summary collapse

OVERWRITEABLE_CLASSES =
[String, Numeric, Symbol].freeze
SWAPPABLE_VALUES =
[true, false].freeze

Class Method Summary collapse

Class Method Details

.run(narrative, *args, &code) ⇒ Object

Parameters:



10
11
12
13
# File 'lib/gamefic/stage.rb', line 10

def run(narrative, *args, &code)
  container = narrative.clone
  narrative.instance_exec(*args, &code).tap { validate_changes narrative, container, code }
end