Class: Wurk::Middleware::I18n::Client

Inherits:
Object
  • Object
show all
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 collapse

Instance Method Summary collapse

Instance Attribute Details

#configObject Originally defined in module ServerMiddleware

Returns the value of attribute config.

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

#loggerObject Originally defined in module ServerMiddleware

#redisObject Originally defined in module ServerMiddleware

#redis_poolObject Originally defined in module ServerMiddleware