Module: DatabaseTransform::SchemaTableRecordMapping
- Defined in:
- lib/database_transform/schema_table_record_mapping.rb
Instance Method Summary collapse
- #memoize_transform(old_primary_key, result) ⇒ Object
-
#transform(old_primary_key) ⇒ Object
Obtains the result of transforming the record with the given primary key.
-
#transformed?(old_primary_key) ⇒ Boolean
Checks if the given primary key has been transformed.
Instance Method Details
#memoize_transform(old_primary_key, result) ⇒ Object
27 28 29 30 |
# File 'lib/database_transform/schema_table_record_mapping.rb', line 27 def memoize_transform(old_primary_key, result) @transformed ||= {} @transformed[old_primary_key] = result end |
#transform(old_primary_key) ⇒ Object
Obtains the result of transforming the record with the given primary key.
7 8 9 10 11 12 13 14 |
# File 'lib/database_transform/schema_table_record_mapping.rb', line 7 def transform(old_primary_key) @transformed ||= {} unless @transformed.has_key?(old_primary_key) raise ActiveRecord::RecordNotFound.new("Key #{old_primary_key} in #{table_name}") end @transformed[old_primary_key] end |
#transformed?(old_primary_key) ⇒ Boolean
Checks if the given primary key has been transformed.
20 21 22 23 |
# File 'lib/database_transform/schema_table_record_mapping.rb', line 20 def transformed?(old_primary_key) @transformed ||= {} @transformed.has_key?(old_primary_key) end |