Module: Hayrick::ClassMethods

Defined in:
lib/hayrick.rb

Instance Method Summary collapse

Instance Method Details

#filter(keyword, callable = nil, &block) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/hayrick.rb', line 31

def filter(keyword, callable = nil, &block)
  (!!callable ^ !!block) || fail(ArgumentError)

  captured_callable = callable || block

  search_filters.add(keyword, captured_callable)
end

#search_filtersObject



39
40
41
# File 'lib/hayrick.rb', line 39

def search_filters
  @search_filters ||= FilterRepository.new
end