Class: TurboTest::StaticAnalysis::ActiveRecord::Constructor
- Inherits:
-
Object
- Object
- TurboTest::StaticAnalysis::ActiveRecord::Constructor
- Defined in:
- lib/turbo_test_static_analysis/active_record_schema/constructor.rb
Instance Method Summary collapse
- #enable_extension(name, content) ⇒ Object
- #fingerprint(table_name, content) ⇒ Object (also: #add_index, #add_foreign_key, #create_table, #create_trigger)
-
#initialize ⇒ Constructor
constructor
A new instance of Constructor.
- #snapshot ⇒ Object
Constructor Details
#initialize ⇒ Constructor
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 |
#snapshot ⇒ Object
28 29 30 31 |
# File 'lib/turbo_test_static_analysis/active_record_schema/constructor.rb', line 28 def snapshot add_fingerprints @schema end |