class TurboTest::StaticAnalysis::ActiveRecord::Constructor

Public Class Methods

new() click to toggle source
# File lib/turbo_test_static_analysis/active_record_schema/constructor.rb, line 7
def initialize
  @schema = Snapshot.new
  @fingerprints = {}
end

Public Instance Methods

add_foreign_key(table_name, content)
Alias for: fingerprint
add_index(table_name, content)
Alias for: fingerprint
create_table(table_name, content)
Alias for: fingerprint
create_trigger(table_name, content)
Alias for: fingerprint
enable_extension(name, content) click to toggle source
# File lib/turbo_test_static_analysis/active_record_schema/constructor.rb, line 12
def enable_extension(name, content)
  extensions[name] = Digest::MD5.hexdigest(content)
end
fingerprint(table_name, content) click to toggle source
# File lib/turbo_test_static_analysis/active_record_schema/constructor.rb, line 16
def fingerprint(table_name, content)
  @fingerprints[table_name] ||= []
  @fingerprints[table_name] << content
end
snapshot() click to toggle source
# File lib/turbo_test_static_analysis/active_record_schema/constructor.rb, line 28
def snapshot
  add_fingerprints
  @schema
end

Private Instance Methods

add_fingerprints() click to toggle source
# File lib/turbo_test_static_analysis/active_record_schema/constructor.rb, line 43
def add_fingerprints
  @fingerprints.each_pair.each_with_object(tables) do |(key, val), memo|
    memo[key] = Digest::MD5.hexdigest(val.sort.join)
  end
end
extensions() click to toggle source
# File lib/turbo_test_static_analysis/active_record_schema/constructor.rb, line 35
def extensions
  @schema[:extensions]
end
tables() click to toggle source
# File lib/turbo_test_static_analysis/active_record_schema/constructor.rb, line 39
def tables
  @schema[:tables]
end