class I18n::Backend::Callbacks

Attributes

after[RW]
before[RW]
wrapped[R]

Public Class Methods

new(wrapped, before: nil, after: nil) click to toggle source
Calls superclass method
# File lib/i18n/backend/callbacks.rb, line 8
def initialize(wrapped, before: nil, after: nil)
  super(wrapped)
  @wrapped = wrapped
  @before = before
  @after = after
end

Public Instance Methods

__getobj__() click to toggle source
# File lib/i18n/backend/callbacks.rb, line 28
def __getobj__
  wrapped
end
__setobj__(obj) click to toggle source

implement the Delegator interface

# File lib/i18n/backend/callbacks.rb, line 24
def __setobj__(obj)
  @wrapped = obj
end
translate(locale, key, options = {}) click to toggle source
# File lib/i18n/backend/callbacks.rb, line 15
def translate(locale, key, options = {})
  locale, key, options = before.call(locale, key, options) if before
  result = wrapped.translate(locale, key, options)
  result = after.call(locale, key, options, result) if after
  result
end