class SmartManagement::Searcher

Public Class Methods

new(data, options) click to toggle source
# File lib/smart_management/searcher.rb, line 3
def initialize(data, options)
  @data = data
  @options = options
end

Public Instance Methods

call() click to toggle source
# File lib/smart_management/searcher.rb, line 8
def call
  if @options.present?
    @options.each do |k, v|
      @data = @data.where("#{@data.table_name}.#{k} like ?", "%#{v}%")
    end
  end
  @data
end