Sha256: d3f3c3fb3233a80698ae40ad5cc9970f5491a6634be374fa1f00a5f219c5cf64

Contents?: true

Size: 554 Bytes

Versions: 62

Compression:

Stored size: 554 Bytes

Contents

# encoding: utf-8
module WebTranslateIt
  
  # Class to automatically fetch the last translations from Web Translate It
  # for every page requested.
  # This can be used as a rack middleware.
  # Implementation example:
  #
  #   # in config/environment.rb:
  #   config.middleware.use "WebTranslateIt::AutoFetch"
  #
  class AutoFetch
    def initialize(app)
      @app = app
    end
  
    def call(env)
      WebTranslateIt::fetch_translations
      status, headers, response = @app.call(env)
      [status, headers, response.body]
    end
  end
end

Version data entries

62 entries across 62 versions & 1 rubygems

Version Path
web_translate_it-1.8.1.2 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.8.1.1 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.8.1.0 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.8.0.1 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.8.0.0 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.3.1 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.3.0 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.2.1 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.2.0 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.1.7 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.1.6 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.1.5 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.1.3 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.1.2 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.1.1 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.1.0 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.1.pre1 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.0.7 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.0.7.pre2 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.0.7.pre lib/web_translate_it/auto_fetch.rb