module I18n::Tests::Interpolation - i18n-0.6.11 Documentation

# module I18n::Tests::Interpolation

### Protected Instance Methods

capture(stream) { || ... } click to toggle source

    # File lib/i18n/tests/interpolation.rb, line 108
    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

euc_jp(string) click to toggle source

    # File lib/i18n/tests/interpolation.rb, line 121
    def euc_jp(string)
      string.encode!(Encoding::EUC_JP)
    end

interpolate(*args) click to toggle source

    # File lib/i18n/tests/interpolation.rb, line 125
    def interpolate(*args)
      options = args.last.is_a?(Hash) ? args.pop : {}
      key = args.pop
      I18n.backend.translate('en', key, options)
    end