Class: ROM::Plugins::Relation::RegistryReader

Inherits:
Module
  • Object
show all
Defined in:
lib/rom/plugins/relation/registry_reader.rb

Overview

Allows relations to access all other relations through registry

For now this plugin is always enabled

Constant Summary collapse

EMPTY_REGISTRY =
RelationRegistry.build(EMPTY_HASH).freeze

Instance Method Summary collapse

Constructor Details

#initialize(readers:) ⇒ RegistryReader

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RegistryReader.



17
18
19
20
# File 'lib/rom/plugins/relation/registry_reader.rb', line 17

def initialize(readers:)
  super()
  include readers
end

Instance Method Details

#included(klass) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



23
24
25
26
27
28
# File 'lib/rom/plugins/relation/registry_reader.rb', line 23

def included(klass)
  super
  return if klass.instance_methods.include?(:__registry__)

  klass.option :__registry__, default: -> { EMPTY_REGISTRY }
end