Class: Copyable::CopyRegistry
- Inherits:
-
Object
- Object
- Copyable::CopyRegistry
- Defined in:
- lib/copyable/copy_registry.rb
Class Method Summary collapse
- .already_copied?(options) ⇒ Boolean
- .clear ⇒ Object
- .fetch_copy(options) ⇒ Object
- .register(original_record, new_record) ⇒ Object
Class Method Details
.already_copied?(options) ⇒ Boolean
19 20 21 |
# File 'lib/copyable/copy_registry.rb', line 19 def already_copied?() fetch_copy().present? end |
.clear ⇒ Object
29 30 31 |
# File 'lib/copyable/copy_registry.rb', line 29 def clear @registry = {} end |
.fetch_copy(options) ⇒ Object
23 24 25 26 27 |
# File 'lib/copyable/copy_registry.rb', line 23 def fetch_copy() @registry ||= {} key = make_hash() @registry[key] end |
.register(original_record, new_record) ⇒ Object
13 14 15 16 17 |
# File 'lib/copyable/copy_registry.rb', line 13 def register(original_record, new_record) @registry ||= {} key = make_hash(record: original_record) @registry[key] = new_record end |