Sha256: 3a7adcc1c2734a8960f3d3117d6e061a52ee4501736d17adeb5bb8ad213ccf8c
Contents?: true
Size: 972 Bytes
Versions: 6
Compression:
Stored size: 972 Bytes
Contents
# frozen_string_literal: true require 'rom/constants' module ROM module Plugins module Relation # Allows relations to access all other relations through registry # # For now this plugin is always enabled # # @api public class RegistryReader < Module EMPTY_REGISTRY = RelationRegistry.new(EMPTY_HASH).freeze # @api private attr_reader :relations # @api private def initialize(relations) @relations = relations define_readers! end # @api private def included(klass) super return if klass.instance_methods.include?(:__registry__) klass.option :__registry__, default: -> { EMPTY_REGISTRY } end private # @api private def define_readers! relations.each do |name| define_method(name) { __registry__[name] } end end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems