Class: Weft::DSL::Sandbox

Inherits:
Object
  • Object
show all
Defined in:
lib/weft/dsl/sandbox.rb

Overview

The self a verb block runs against — a "void context": empty of anything component-specific, so a block cannot reach local state and is portable to any process. Verb blocks (derives, performs, transfers, recovers, includes) are (params) -> value pure functions: their arguments and return value are explicit, constants resolve lexically, and Kernel stays reachable (raise, format, Integer()).

Each execution runs in a fresh instance, dropped once the return value is captured — so a block may use scratch instance variables freely, but that scratch never leaks past its own execution. Instances are deliberately unfrozen (scratch is allowed) yet non-leaking (freshness, not freezing, is what isolates them); a future register_helpers facility would add vocabulary here without changing that contract.

Class Method Summary collapse

Class Method Details

.runObject

Run a block in a fresh sandbox and return its value. Extra arguments after params ride through to the block (recovery blocks take (params, error)). Each call gets its own instance by construction, so no caller can reuse one across executions.



23
# File 'lib/weft/dsl/sandbox.rb', line 23

def self.run(...) = new.instance_exec(...)