Class: ROM::Repository::RelationReader::Readers 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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(relations) ⇒ Readers

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



46
47
48
49
50
51
52
# File 'lib/rom/repository/relation_reader.rb', line 46

def initialize(relations)
  super()

  include InstanceMethods

  define_readers(relations)
end

Instance Attribute Details

#cacheObject (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.



44
45
46
# File 'lib/rom/repository/relation_reader.rb', line 44

def cache
  @cache
end

Instance Method Details

#define_readers(relations) ⇒ 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.



55
56
57
58
59
60
# File 'lib/rom/repository/relation_reader.rb', line 55

def define_readers(relations)
  cache = Cache.new
  relations.each do |name|
    define_readers_for_relation(cache, name)
  end
end

#define_readers_for_relation(cache, name) ⇒ 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.



63
64
65
66
67
# File 'lib/rom/repository/relation_reader.rb', line 63

def define_readers_for_relation(cache, name)
  define_method(name) do |**kwargs|
    relation_reader(cache, name, **kwargs)
  end
end