module LazyRecord::ClassMethods

Class methods extended to all LazyRecord descendants.

Public Instance Methods

all() click to toggle source
# File lib/lazy_record/class_methods.rb, line 16
def all
  @all ||= Relation.new(klass: self)
end
attr_readers() click to toggle source
# File lib/lazy_record/class_methods.rb, line 12
def attr_readers
  @attr_readers ||= []
end
count() click to toggle source
# File lib/lazy_record/class_methods.rb, line 20
def count
  all.count
end
destroy_all() click to toggle source
# File lib/lazy_record/class_methods.rb, line 36
def destroy_all
  all.send(:clear)
end
first() click to toggle source
# File lib/lazy_record/class_methods.rb, line 24
def first
  all.first
end
last() click to toggle source
# File lib/lazy_record/class_methods.rb, line 28
def last
  all.last
end
public_attr_readers() click to toggle source
# File lib/lazy_record/class_methods.rb, line 6
def public_attr_readers
  @public_attr_readers ||= attr_readers.reject do |reader|
    private_method_defined?(reader) || protected_method_defined?(reader)
  end
end
where(condition = nil, &block) click to toggle source
# File lib/lazy_record/class_methods.rb, line 32
def where(condition = nil, &block)
  all.where(condition, &block)
end