Class: Wurk::Middleware::I18n::Client
- Inherits:
-
Object
- Object
- Wurk::Middleware::I18n::Client
- Includes:
- ServerMiddleware
- Defined in:
- lib/wurk/middleware/i18n.rb
Overview
Client: writes the current locale into the outgoing job hash before push. Idempotent — a caller-supplied ‘“locale”` is preserved. No-op when I18n isn’t loaded (don’t introduce a nil ‘“locale”` key: adding it would change the wire shape for callers without I18n).
Instance Attribute Summary
Attributes included from ServerMiddleware
Instance Method Summary collapse
Methods included from ServerMiddleware
Instance Method Details
#call(_job_class, job, _queue, _redis_pool) ⇒ Object
41 42 43 44 45 |
# File 'lib/wurk/middleware/i18n.rb', line 41 def call(_job_class, job, _queue, _redis_pool) current = I18n.current_locale job['locale'] ||= current if current yield end |