bruteSourceBruteStoreSnapshotStoreself

class << self

Definitions

def save(path)

Push the current content of +path+ onto the snapshot stack. If the file doesn't exist yet, records +:did_not_exist+.

Implementation

def save(path)
  key = File.expand_path(path)
  content = File.exist?(key) ? File.read(key) : :did_not_exist
  @mutex.synchronize { @snapshots[key].push(content) }
end

def pop(path)

Pop and return the most recent snapshot for +path+, or +nil+ if there is no history.

Implementation

def pop(path)
  key = File.expand_path(path)
  @mutex.synchronize { @snapshots[key].pop }
end

def clear!

Clear all snapshots. Used in tests and session resets.

Implementation

def clear!
  @mutex.synchronize { @snapshots.clear }
end