Sha256: 4894493874351b26e172da558d65ebb9843f143151895f21d13eac1efdee8779

Contents?: true

Size: 627 Bytes

Versions: 2

Compression:

Stored size: 627 Bytes

Contents

class InterceptBuilder
  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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
intercept-0.2.5 lib/intercept_builder.rb
intercept-0.2.2 lib/intercept_builder.rb