Class: ActiverecordHoarder::RecordCollector
- Inherits:
-
Object
- Object
- ActiverecordHoarder::RecordCollector
- Defined in:
- lib/activerecord_hoarder/record_collector.rb
Instance Attribute Summary collapse
-
#relative_limit ⇒ Object
readonly
Returns the value of attribute relative_limit.
Instance Method Summary collapse
- #in_batches(delete_on_success: false) ⇒ Object
-
#initialize(model_class) ⇒ RecordCollector
constructor
A new instance of RecordCollector.
Constructor Details
#initialize(model_class) ⇒ RecordCollector
Returns a new instance of RecordCollector.
4 5 6 |
# File 'lib/activerecord_hoarder/record_collector.rb', line 4 def initialize(model_class) @model_class = model_class end |
Instance Attribute Details
#relative_limit ⇒ Object (readonly)
Returns the value of attribute relative_limit.
2 3 4 |
# File 'lib/activerecord_hoarder/record_collector.rb', line 2 def relative_limit @relative_limit end |
Instance Method Details
#in_batches(delete_on_success: false) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/activerecord_hoarder/record_collector.rb', line 8 def in_batches(delete_on_success: false) while collect_batch yield @batch next if !delete_on_success destroy_current_records! end end |