class PactBroker::Versions::EagerLoaders::LatestVersionForPacticipant
Public Class Methods
call(eo, **_other)
click to toggle source
# File lib/pact_broker/versions/eager_loaders.rb, line 5 def self.call(eo, **_other) populate_associations(eo[:rows]) end
group_by_pacticipant(versions)
click to toggle source
# File lib/pact_broker/versions/eager_loaders.rb, line 15 def self.group_by_pacticipant(versions) versions.to_a.group_by(&:pacticipant) end
populate_associations(versions)
click to toggle source
# File lib/pact_broker/versions/eager_loaders.rb, line 9 def self.populate_associations(versions) group_by_pacticipant(versions).each do | pacticipant, participant_versions | populate_associations_by_pacticipant(pacticipant, participant_versions) end end
populate_associations_by_pacticipant(pacticipant, versions)
click to toggle source
# File lib/pact_broker/versions/eager_loaders.rb, line 19 def self.populate_associations_by_pacticipant(pacticipant, versions) latest_version = versions.first.class.latest_version_for_pacticipant(pacticipant).single_record versions.each do | version | version.associations[:latest_version_for_pacticipant] = latest_version end end