Class: ROM::Repository::RelationReader Private

Inherits:
Module
  • Object
show all
Defined in:
lib/rom/repository/relation_reader.rb

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

Defined Under Namespace

Modules: InstanceMethods Classes: Readers

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relations:, cache:, root: Undefined) ⇒ RelationReader

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 RelationReader.



71
72
73
74
75
# File 'lib/rom/repository/relation_reader.rb', line 71

def initialize(relations:, cache:, root: Undefined)
  super()

  add_readers(relations, cache, root)
end

Class Method Details

.added_to?(klass) ⇒ Boolean

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.



7
8
9
# File 'lib/rom/repository/relation_reader.rb', line 7

def self.added_to?(klass)
  klass < InstanceMethods
end

Instance Method Details

#add_readers(relations, cache, root) ⇒ 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.



78
79
80
81
82
83
84
85
86
# File 'lib/rom/repository/relation_reader.rb', line 78

def add_readers(relations, cache, root)
  include cache.fetch_or_store(:relation_readers) {
    Readers.new(relations)
  }

  unless Undefined.equal?(root)
    define_method(:root) { |**kwargs| public_send(root, **kwargs) }
  end
end