module I18n::Tests::Interpolation

Protected Instance Methods

# File lib/i18n/tests/interpolation.rb, line 161
def capture(stream)
  begin
    stream = stream.to_s
    eval "$#{stream} = StringIO.new"
    yield
    result = eval("$#{stream}").string
  ensure
    eval("$#{stream} = #{stream.upcase}")
  end

  result
end
# File lib/i18n/tests/interpolation.rb, line 174
def euc_jp(string)
  string.encode!(Encoding::EUC_JP)
end
# File lib/i18n/tests/interpolation.rb, line 178
def interpolate(*args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  key = args.pop
  I18n.backend.translate('en', key, options)
end