Module: Sequel::Plugins::EagerEach::DatasetMethods

Defined in:
lib/sequel/plugins/eager_each.rb

Instance Method Summary collapse

Instance Method Details

#all(&block) ⇒ Object

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



46
47
48
49
50
51
52
# 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

#columnsObject

Don’t call #all when attempting to load the columns.



26
27
28
29
30
31
32
# 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) ⇒ Object

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



36
37
38
39
40
41
42
# File 'lib/sequel/plugins/eager_each.rb', line 36

def each(&block)
  if use_eager_all?
    all(&block)
  else
    super
  end
end