Class: MingleEvents::Processors::CategoryFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/mingle_events/processors/category_filter.rb

Overview

Removes events from the stream that do not match all of the specified categories

Instance Method Summary collapse

Methods inherited from Filter

#process_events

Constructor Details

#initialize(categories) ⇒ CategoryFilter

Returns a new instance of CategoryFilter.



7
8
9
# File 'lib/mingle_events/processors/category_filter.rb', line 7

def initialize(categories)
  @categories = categories
end

Instance Method Details

#match?(event) ⇒ Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/mingle_events/processors/category_filter.rb', line 11

def match?(event)
  @categories.all?{|c| event.categories.include?(c)}
end