Class: LittleGhost::Workspace
- Inherits:
-
Object
- Object
- LittleGhost::Workspace
- Defined in:
- lib/little_ghost/workspace.rb
Overview
A Workspace gives an agent a concrete home for files. Pair it with a Sandbox to decide how those files may be read, changed, or used by commands.
workspace = LittleGhost::Workspace.new(root: "./tmp/support-run")
workspace.root # => an absolute path ending in "/tmp/support-run"
Workspaces participate in the run resource lifecycle. A custom workspace can provision storage in #open and release it in #close.
Instance Attribute Summary collapse
-
#root ⇒ Object
readonly
Absolute filesystem root assigned to this workspace.
Instance Method Summary collapse
-
#close ⇒ Object
Releases workspace resources.
-
#initialize(root:) ⇒ Workspace
constructor
Expands
rootto an absolute path. -
#open(run: nil) ⇒ Object
Opens any run-scoped resources and yields this workspace to the run.
Constructor Details
Instance Attribute Details
#root ⇒ Object (readonly)
Absolute filesystem root assigned to this workspace.
19 20 21 |
# File 'lib/little_ghost/workspace.rb', line 19 def root @root end |
Instance Method Details
#close ⇒ Object
Releases workspace resources. The default workspace has nothing to close.
27 28 29 |
# File 'lib/little_ghost/workspace.rb', line 27 def close nil end |
#open(run: nil) ⇒ Object
Opens any run-scoped resources and yields this workspace to the run.
22 23 24 |
# File 'lib/little_ghost/workspace.rb', line 22 def open(run: nil) self end |