Class: ROM::Plugins::Relation::RegistryReader
- Inherits:
-
Module
- Object
- Module
- ROM::Plugins::Relation::RegistryReader
- Defined in:
- core/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
- #included(klass) ⇒ Object private
-
#initialize(klass:, relation_readers_module:) ⇒ RegistryReader
constructor
private
A new instance of RegistryReader.
Constructor Details
#initialize(klass:, relation_readers_module:) ⇒ 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 |
# File 'core/lib/rom/plugins/relation/registry_reader.rb', line 17 def initialize(klass:, relation_readers_module:) klass.include relation_readers_module 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.
22 23 24 25 26 27 |
# File 'core/lib/rom/plugins/relation/registry_reader.rb', line 22 def included(klass) super return if klass.instance_methods.include?(:__registry__) klass.option :__registry__, default: -> { EMPTY_REGISTRY } end |