Sha256: 76af6d0b59c3e092aeef86dda4024fa5e51e7e3ea665cf166788a6d7c6066313
Contents?: true
Size: 1.45 KB
Versions: 26
Compression:
Stored size: 1.45 KB
Contents
module Foobara module Persistence class EntityBase class TransactionTable module Concerns # If something accesses the crud driver and manipulates records then it belongs in this concern. module Queries # TODO: why is this query method here but the rest are not? def all(&) enumerator = Enumerator.new do |yielder| tracked_records.each do |record| next if record.hard_deleted? # if the record is not loaded, it could be an unloaded thunk with a primary key to a row that has # been deleted or maybe never even existed. So just exclude those and let them come from the # database in the next loop if created?(record) || record.loaded? yielder << record end end entity_attributes_crud_driver_table.all.each do |attributes| attributes = normalize_attributes(attributes) primary_key = primary_key_for_attributes(attributes) next if tracked_records.include_key?(primary_key) yielder << entity_class.loaded(attributes) end end if block_given? enumerator.each(&) else enumerator.to_a end end end end end end end end
Version data entries
26 entries across 26 versions & 1 rubygems