class SmartManagement::IndexBuilder

Attributes

klass[RW]
options[RW]

Public Class Methods

new(klass, options) click to toggle source
# File lib/smart_management/index_builder.rb, line 5
def initialize(klass, options)
  @klass = klass
  @options = options
end

Public Instance Methods

items() click to toggle source
# File lib/smart_management/index_builder.rb, line 10
def items
  items = searched_items
  items = Paginer.new(items, options[:pagination]).call
  Sorter.new(items, options[:sort]).call
end
total() click to toggle source
# File lib/smart_management/index_builder.rb, line 16
def total
  @total ||= searched_items.count
end

Private Instance Methods

searched_items() click to toggle source
# File lib/smart_management/index_builder.rb, line 22
def searched_items
  @seached_items ||= Searcher.new(klass.all, options[:search]).call
end