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-2.1.5 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.1.4 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.1.3 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.1.2 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.1.1 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.8 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.7 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.6 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.5 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.4 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.3 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.2 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.1 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.0 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.0.rc4 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.0.rc3 lib/web_translate_it/auto_fetch.rb
web_translate_it-2.0.0.rc2 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.10.2 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.10.1 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.10.0 lib/web_translate_it/auto_fetch.rb