Sha256: 03523a1dbd550e0b6f72e23662b4ce61906b7dc2181e3a1befb5f0cdc0aa69ff
Contents?: true
Size: 620 Bytes
Versions: 1
Compression:
Stored size: 620 Bytes
Contents
# frozen_string_literal: true module ROM module Registries # @api public class Associations < Root # @api public def fetch(key, &block) super(key) { components.key?(key) ? super(key, &block) : fetch_aliased_association(key) } end alias_method :[], :fetch private # @api private def fetch_aliased_association(key) components .associations(namespace: namespace) .detect { |assoc| key == "#{namespace}.#{assoc.config.name}" } .then { |assoc| fetch(assoc.config.as) if assoc } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rom-6.0.0.alpha1 | lib/rom/registries/associations.rb |