Class: SandthornSequelProjection::EventHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/sandthorn_sequel_projection/event_handler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ EventHandler

Returns a new instance of EventHandler.



6
7
8
9
# File 'lib/sandthorn_sequel_projection/event_handler.rb', line 6

def initialize(options)
  @filter = SandthornEventFilter::Filter.new
  parse_options(options)
end

Instance Attribute Details

#filterObject (readonly)

Returns the value of attribute filter.



4
5
6
# File 'lib/sandthorn_sequel_projection/event_handler.rb', line 4

def filter
  @filter
end

#messageObject (readonly)

Returns the value of attribute message.



4
5
6
# File 'lib/sandthorn_sequel_projection/event_handler.rb', line 4

def message
  @message
end

#projectionObject (readonly)

Returns the value of attribute projection.



4
5
6
# File 'lib/sandthorn_sequel_projection/event_handler.rb', line 4

def projection
  @projection
end

Instance Method Details

#handle(target, event) ⇒ Object



11
12
13
14
15
# File 'lib/sandthorn_sequel_projection/event_handler.rb', line 11

def handle(target, event)
  if filter.match?(event)
    call_handler(target, event)
  end
end