Class: Unity::DynamoDBStreams::EventProcessor::TableHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/unity/dynamodbstreams/event_processor.rb

Instance Method Summary collapse

Constructor Details

#initializeTableHandler

Returns a new instance of TableHandler.



49
50
51
# File 'lib/unity/dynamodbstreams/event_processor.rb', line 49

def initialize
  @handlers = { insert: [], remove: [], update: [] }
end

Instance Method Details

#each(type, &block) ⇒ Object



69
70
71
# File 'lib/unity/dynamodbstreams/event_processor.rb', line 69

def each(type, &block)
  @handlers[type].each(&block)
end

#on(type, handler = nil, &block) ⇒ Object



53
54
55
# File 'lib/unity/dynamodbstreams/event_processor.rb', line 53

def on(type, handler = nil, &block)
  @handlers[type] << handler || block
end

#on_insert(handler = nil, &block) ⇒ Object



57
58
59
# File 'lib/unity/dynamodbstreams/event_processor.rb', line 57

def on_insert(handler = nil, &block)
  on(:insert, handler || block)
end

#on_remove(handler = nil, &block) ⇒ Object



61
62
63
# File 'lib/unity/dynamodbstreams/event_processor.rb', line 61

def on_remove(handler = nil, &block)
  on(:remove, handler || block)
end

#on_update(handler = nil, &block) ⇒ Object



65
66
67
# File 'lib/unity/dynamodbstreams/event_processor.rb', line 65

def on_update(handler = nil, &block)
  on(:update, handler || block)
end