Sha256: 8437e9012ea1db5c1902ab60d3890f2f0b92d12cfc71bd62d41f846fab85a29d
Contents?: true
Size: 770 Bytes
Versions: 15
Compression:
Stored size: 770 Bytes
Contents
require 'routemaster/dirty/filter' module Routemaster module Middleware # Filters event payloads passed in the environment (in # `env['routemaster.payload']`), is any. # # Will use `Routemaster::Dirty::Filter` by default. class Filter # @param filter [Routemaster::Dirty::Filter] an event filter (optional; # will be created using the `redis` and `expiry` options if not provided) def initialize(app, filter:nil) @app = app @filter = filter || Routemaster::Dirty::Filter.new end def call(env) payload = env['routemaster.payload'] if payload && payload.any? env['routemaster.payload'] = @filter.run(payload) end @app.call(env) end end end end
Version data entries
15 entries across 15 versions & 1 rubygems