Class: ROM::Plugins::Relation::RegistryReader
- Inherits:
-
Module
- Object
- Module
- ROM::Plugins::Relation::RegistryReader
- 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.new(EMPTY_HASH).freeze
Instance Attribute Summary collapse
- #relations ⇒ Object readonly private
Instance Method Summary collapse
- #included(klass) ⇒ Object private
-
#initialize(relations) ⇒ RegistryReader
constructor
private
A new instance of RegistryReader.
Constructor Details
#initialize(relations) ⇒ 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.
18 19 20 21 |
# File 'lib/rom/plugins/relation/registry_reader.rb', line 18 def initialize(relations) @relations = relations define_readers! end |
Instance Attribute Details
#relations ⇒ Object (readonly)
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.
15 16 17 |
# File 'lib/rom/plugins/relation/registry_reader.rb', line 15 def relations @relations 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.
24 25 26 27 28 |
# File 'lib/rom/plugins/relation/registry_reader.rb', line 24 def included(klass) super return if klass.instance_methods.include?(:__registry__) klass.option :__registry__, default: -> { EMPTY_REGISTRY } end |