Class: ClaudeMemory::Infrastructure::InMemoryFileSystem

Inherits:
Object
  • Object
show all
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

Constructor Details

#initializeInMemoryFileSystem

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

Returns:

  • (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