Class: Space::Src::Cloner
- Inherits:
-
Object
- Object
- Space::Src::Cloner
- Defined in:
- lib/space_src/cloner.rb
Overview
Resolution + COW-copy boundary for ‘clone`. Returns Result; no side effects on Failure. Injected shell seam defaults to ShellRunner (wraps Shell.run in Sync{} so the Fiber-scheduler requirement is met from a plain synchronous CLI command — same pattern as Launchd::Agent).
Defined Under Namespace
Classes: ShellRunner
Instance Method Summary collapse
-
#call(name:, into: ".") ⇒ Object
Resolve ‘name` against `base_dir` and copy to `into/<leaf>`.
-
#initialize(base_dir:, shell: ShellRunner.new) ⇒ Cloner
constructor
A new instance of Cloner.
Constructor Details
#initialize(base_dir:, shell: ShellRunner.new) ⇒ Cloner
Returns a new instance of Cloner.
21 22 23 24 |
# File 'lib/space_src/cloner.rb', line 21 def initialize(base_dir:, shell: ShellRunner.new) @base_dir = File.(base_dir) @shell = shell end |
Instance Method Details
#call(name:, into: ".") ⇒ Object
Resolve ‘name` against `base_dir` and copy to `into/<leaf>`. Returns Success(dest_path) or Failure(message).
28 29 30 31 32 |
# File 'lib/space_src/cloner.rb', line 28 def call(name:, into: ".") result = resolve(name) return result if result.failure? copy(result.success, into) end |