module Sequel::Plugins::EagerEach::DatasetMethods

Public Instance Methods

all(&block) click to toggle source

If eager loading, clone the dataset and set a flag to let each know not to call all, to avoid the infinite loop.

Calls superclass method
# File lib/sequel/plugins/eager_each.rb, line 46
def all(&block)
  if use_eager_all?
    clone(:all_called=>true).all(&block)
  else
    super
  end
end
columns() click to toggle source

Don't call all when attempting to load the columns.

Calls superclass method
# File lib/sequel/plugins/eager_each.rb, line 26
def columns
  if use_eager_all?
    clone(:all_called=>true).columns
  else
    super
  end
end
each(&block) click to toggle source

Call all instead of each if eager loading, uless each is being called by all.

Calls superclass method
# File lib/sequel/plugins/eager_each.rb, line 36
def each(&block)
  if use_eager_all?
    all(&block)
  else
    super
  end
end

Private Instance Methods

use_eager_all?() click to toggle source

Wether to use all when each is called, true when eager loading unless the flag has already been set.

# File lib/sequel/plugins/eager_each.rb, line 58
def use_eager_all?
  (opts[:eager] || opts[:eager_graph]) && !opts[:all_called]
end