class ROM::Plugins::Relation::RegistryReader
Allows relations to access all other relations through registry
For now this plugin is always enabled
@api public
Constants
- EMPTY_REGISTRY
Attributes
relations[R]
@api private
Public Class Methods
new(relations:)
click to toggle source
@api private
# File lib/rom/plugins/relation/registry_reader.rb, line 20 def initialize(relations:) @relations = relations define_readers! end
Public Instance Methods
included(klass)
click to toggle source
@api private
Calls superclass method
# File lib/rom/plugins/relation/registry_reader.rb, line 26 def included(klass) super return if klass.instance_methods.include?(:__registry__) klass.option :__registry__, default: -> { EMPTY_REGISTRY } end
Private Instance Methods
define_readers!()
click to toggle source
@api private
# File lib/rom/plugins/relation/registry_reader.rb, line 36 def define_readers! relations.each do |name| define_method(name) { __registry__[name] } end end