Class: ClaudeMemory::Infrastructure::InMemoryFileSystem
- Inherits:
-
Object
- Object
- ClaudeMemory::Infrastructure::InMemoryFileSystem
- Defined in:
- lib/claude_memory/infrastructure/in_memory_file_system.rb
Overview
In-memory filesystem implementation for fast testing Does not touch the real filesystem
Instance Method Summary collapse
- #exist?(path) ⇒ Boolean
- #file_hash(path) ⇒ Object
-
#initialize ⇒ InMemoryFileSystem
constructor
A new instance of InMemoryFileSystem.
- #read(path) ⇒ Object
- #write(path, content) ⇒ Object
Constructor Details
#initialize ⇒ InMemoryFileSystem
Returns a new instance of InMemoryFileSystem.
10 11 12 |
# File 'lib/claude_memory/infrastructure/in_memory_file_system.rb', line 10 def initialize @files = {} end |
Instance Method Details
#exist?(path) ⇒ Boolean
14 15 16 |
# File 'lib/claude_memory/infrastructure/in_memory_file_system.rb', line 14 def exist?(path) @files.key?(path) end |
#file_hash(path) ⇒ Object
26 27 28 29 |
# File 'lib/claude_memory/infrastructure/in_memory_file_system.rb', line 26 def file_hash(path) content = read(path) Digest::SHA256.hexdigest(content) end |
#read(path) ⇒ Object
18 19 20 |
# File 'lib/claude_memory/infrastructure/in_memory_file_system.rb', line 18 def read(path) @files.fetch(path) { raise Errno::ENOENT, path } end |
#write(path, content) ⇒ Object
22 23 24 |
# File 'lib/claude_memory/infrastructure/in_memory_file_system.rb', line 22 def write(path, content) @files[path] = content end |