Class: LittleGhost::Sandbox::IsolatedBackend
- Inherits:
-
Sandbox
- Object
- Sandbox
- LittleGhost::Sandbox::IsolatedBackend
show all
- Defined in:
- lib/little_ghost/sandbox/isolated_backend.rb
Overview
Shared policy and filesystem behavior for enforcing backends.
Instance Attribute Summary collapse
Instance Method Summary
collapse
-
#initialize(workspace:, policy: nil, profiles: {}, limits: {}) ⇒ IsolatedBackend
constructor
-
#list(path = ".", context: nil) ⇒ Object
-
#read(path, context: nil) ⇒ Object
-
#replace(path, old_text, new_text, context: nil) ⇒ Object
-
#writable? ⇒ Boolean
-
#write(path, content, context: nil) ⇒ Object
Constructor Details
#initialize(workspace:, policy: nil, profiles: {}, limits: {}) ⇒ IsolatedBackend
11
12
13
14
|
# File 'lib/little_ghost/sandbox/isolated_backend.rb', line 11
def initialize(workspace:, policy: nil, profiles: {}, limits: {})
super
@effective_policy = policy_with_network_default(self.policy)
end
|
Instance Attribute Details
#effective_policy ⇒ Object
Returns the value of attribute effective_policy.
16
17
18
|
# File 'lib/little_ghost/sandbox/isolated_backend.rb', line 16
def effective_policy
@effective_policy
end
|
Instance Method Details
#list(path = ".", context: nil) ⇒ Object
23
|
# File 'lib/little_ghost/sandbox/isolated_backend.rb', line 23
def list(path = ".", context: nil) = default_scope.list(path, context:)
|
#read(path, context: nil) ⇒ Object
22
|
# File 'lib/little_ghost/sandbox/isolated_backend.rb', line 22
def read(path, context: nil) = default_scope.read(path, context:)
|
#replace(path, old_text, new_text, context: nil) ⇒ Object
25
|
# File 'lib/little_ghost/sandbox/isolated_backend.rb', line 25
def replace(path, old_text, new_text, context: nil) = default_scope.replace(path, old_text, new_text, context:)
|
#writable? ⇒ Boolean
18
19
20
|
# File 'lib/little_ghost/sandbox/isolated_backend.rb', line 18
def writable?
capabilities.supports?(:filesystem_write) && effective_policy.process_grants(workspace).any?(&:writable?)
end
|
#write(path, content, context: nil) ⇒ Object
24
|
# File 'lib/little_ghost/sandbox/isolated_backend.rb', line 24
def write(path, content, context: nil) = default_scope.write(path, content, context:)
|