Class: RealDataTests::RecordCollector
- Inherits:
-
Object
- Object
- RealDataTests::RecordCollector
- Defined in:
- lib/real_data_tests/record_collector.rb
Instance Attribute Summary collapse
-
#collected_records ⇒ Object
readonly
Returns the value of attribute collected_records.
-
#collection_stats ⇒ Object
readonly
Returns the value of attribute collection_stats.
Instance Method Summary collapse
- #collect ⇒ Object
-
#initialize(record) ⇒ RecordCollector
constructor
A new instance of RecordCollector.
Constructor Details
#initialize(record) ⇒ RecordCollector
Returns a new instance of RecordCollector.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/real_data_tests/record_collector.rb', line 5 def initialize(record) @record = record @collected_records = Set.new @collection_stats = {} @processed_associations = Set.new @association_path = [] @current_depth = 0 @visited_associations = {} @processed_self_refs = Hash.new { |h, k| h[k] = Set.new } init_collection_stats(record) end |
Instance Attribute Details
#collected_records ⇒ Object (readonly)
Returns the value of attribute collected_records.
3 4 5 |
# File 'lib/real_data_tests/record_collector.rb', line 3 def collected_records @collected_records end |
#collection_stats ⇒ Object (readonly)
Returns the value of attribute collection_stats.
3 4 5 |
# File 'lib/real_data_tests/record_collector.rb', line 3 def collection_stats @collection_stats end |
Instance Method Details
#collect ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/real_data_tests/record_collector.rb', line 18 def collect puts "\nStarting record collection from: #{@record.class.name}##{@record.id}" filter_mode = RealDataTests.configuration.current_preset.association_filter_mode filter_list = RealDataTests.configuration.current_preset.association_filter_list puts "Using #{filter_mode || 'no'} filter with #{filter_list.any? ? filter_list.join(', ') : 'no associations'}" collect_record(@record, 0) print_collection_stats @collected_records.to_a end |