class GovFakeNotify::Store
A central store for storing all state in the app - uses a basic PStore
Public Class Methods
clear_attachments!(config: Config.instance)
click to toggle source
# File lib/gov_fake_notify/store.rb, line 23 def self.clear_attachments!(config: Config.instance) FileUtils.rm_rf File.join(config.attachments_path, '.') end
clear_messages!()
click to toggle source
# File lib/gov_fake_notify/store.rb, line 12 def self.clear_messages! instance.transaction do instance.roots.each do |key| next unless key =~ /^message-/ instance.delete(key) end end clear_attachments! end
instance()
click to toggle source
# File lib/gov_fake_notify/store.rb, line 8 def self.instance Thread.current[:gov_fake_notify_store] ||= ::PStore.new(GovFakeNotify.config.database_file) end