Class: MingleEvents::Processors::AuthorFilter

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

Overview

Removes all events from stream not triggered by the specified author

Defined Under Namespace

Classes: AuthorSpec

Instance Method Summary collapse

Methods inherited from Filter

#process_events

Constructor Details

#initialize(spec, mingle_access, project_identifier) ⇒ AuthorFilter

Returns a new instance of AuthorFilter.



7
8
9
10
11
12
13
# File 'lib/mingle_events/processors/author_filter.rb', line 7

def initialize(spec, mingle_access, project_identifier)
  unless spec.size == 1
    raise "Author spec must contain 1 and only 1 piece of criteria (the only legal criteria are each unique identifiers in and of themselves so multiple criteria is not needed.)"
  end
  
  @author_spec = AuthorSpec.new(spec, mingle_access, project_identifier)
end

Instance Method Details

#match?(event) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/mingle_events/processors/author_filter.rb', line 15

def match?(event)
  @author_spec.event_triggered_by?(event)
end