Module: Foundries::Snapshot

Defined in:
lib/foundries/snapshot.rb,
lib/foundries/snapshot/store.rb,
lib/foundries/snapshot/adapter.rb,
lib/foundries/snapshot/fingerprint.rb,
lib/foundries/snapshot/adapters/sqlite_adapter.rb,
lib/foundries/snapshot/adapters/postgres_adapter.rb

Defined Under Namespace

Modules: Adapter, Adapters Classes: Fingerprint, Store

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.connectionObject



19
20
21
# File 'lib/foundries/snapshot.rb', line 19

def connection
  @connection || ActiveRecord::Base.connection
end

.enabled=(value) ⇒ Object (writeonly)

Sets the attribute enabled

Parameters:

  • value

    the value to set the attribute enabled to.



13
14
15
# File 'lib/foundries/snapshot.rb', line 13

def enabled=(value)
  @enabled = value
end

.source_pathsObject



23
24
25
# File 'lib/foundries/snapshot.rb', line 23

def source_paths
  @source_paths || []
end

.storage_pathObject



15
16
17
# File 'lib/foundries/snapshot.rb', line 15

def storage_path
  @storage_path || "tmp/foundries"
end

Class Method Details

.adapterObject



32
33
34
# File 'lib/foundries/snapshot.rb', line 32

def adapter
  @adapter ||= Adapter.for(connection)
end

.enabled?Boolean

Returns:

  • (Boolean)


27
28
29
30
# File 'lib/foundries/snapshot.rb', line 27

def enabled?
  return @enabled unless @enabled.nil?
  ENV["FOUNDRIES_CACHE"] == "1"
end

.reset!Object



36
37
38
39
# File 'lib/foundries/snapshot.rb', line 36

def reset!
  @adapter = nil
  @source_paths = nil
end