Class: TurboTest::StaticAnalysis::ActiveRecord::Constructor

Inherits:
Object
  • Object
show all
Defined in:
lib/turbo_test_static_analysis/active_record_schema/constructor.rb

Instance Method Summary collapse

Constructor Details

#initializeConstructor

Returns a new instance of Constructor.



7
8
9
10
# File 'lib/turbo_test_static_analysis/active_record_schema/constructor.rb', line 7

def initialize
  @schema = Snapshot.new
  @fingerprints = {}
end

Instance Method Details

#enable_extension(name, content) ⇒ Object



12
13
14
# 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) ⇒ Object Also known as: add_index, add_foreign_key, create_table, create_trigger



16
17
18
19
# 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

#snapshotObject



28
29
30
31
# File 'lib/turbo_test_static_analysis/active_record_schema/constructor.rb', line 28

def snapshot
  add_fingerprints
  @schema
end