Class: QueryableAssociationProxy

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/sequel_mapper/queryable_association_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(database_enum, loader) ⇒ QueryableAssociationProxy

Returns a new instance of QueryableAssociationProxy.



2
3
4
5
# File 'lib/sequel_mapper/queryable_association_proxy.rb', line 2

def initialize(database_enum, loader)
  @database_enum = database_enum
  @loader = loader
end

Instance Method Details

#each(&block) ⇒ Object



18
19
20
21
22
# File 'lib/sequel_mapper/queryable_association_proxy.rb', line 18

def each(&block)
  database_enum
    .map(&loader)
    .each(&block)
end

#where(criteria) ⇒ Object



13
14
15
16
# File 'lib/sequel_mapper/queryable_association_proxy.rb', line 13

def where(criteria)
  @database_enum = database_enum.where(criteria)
  self
end