Sha256: 499cb0c0a3a42d7b3390139633e2dc788f16569c4f908cd9b3c1f8bc65a52c3f
Contents?: true
Size: 602 Bytes
Versions: 246
Compression:
Stored size: 602 Bytes
Contents
module Actions module Middleware # Keeps the locale value from plan and keeps that in run/finalize # so that the error from there are localized correctly class KeepLocale < Dynflow::Middleware def plan(*args) pass(*args).tap { action.input[:locale] = I18n.locale } end def run(*args) with_locale { pass(*args) } end def finalize with_locale { pass } end private def with_locale(&_block) I18n.locale = action.input[:locale] yield ensure I18n.locale = nil end end end end
Version data entries
246 entries across 246 versions & 1 rubygems