Class: Monster::Remote::Filter

Inherits:
Object
  • Object
show all
Defined in:
lib/monster/remote/filters/filter.rb

Direct Known Subclasses

NameBasedFilter

Instance Method Summary collapse

Instance Method Details

#filter(entries) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/monster/remote/filters/filter.rb', line 12

def filter(entries)
  return [] if entries.nil?
  allowed = entries
  @rejecting.each do |logic|
    allowed = logic.call(allowed)
  end
  allowed
end

#reject(reject_logic) ⇒ Object



6
7
8
9
10
# File 'lib/monster/remote/filters/filter.rb', line 6

def reject(reject_logic)
  @rejecting ||= []
  @rejecting << reject_logic
  self
end