2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/intercept_builder.rb', line 2
def self.build_worker(callback, description)
interceptor_map = {}
decorator_map = {}
description[:interception].each do |unit|
strategy = Intercept::StrategyBuilder.from_hash(unit[:strategy])
unit[:fields].each do |field|
interceptor_map[field] = strategy
end
end
description[:decoration].each do |unit|
decorator = Intercept::DecoratorBuilder.from_hash(unit[:decorator])
unit[:fields].each do |field|
decorator_map[field] = decorator
end
end
Intercept::Worker.new(callback, interceptor_map, decorator_map)
end
|