Sha256: 8c62898b74892472e1e099fd0cbf1d885d5bd585783562c4767f88aabf6f1f57

Contents?: true

Size: 536 Bytes

Versions: 22

Compression:

Stored size: 536 Bytes

Contents

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

22 entries across 22 versions & 2 rubygems

Version Path
web_translate_it-1.7.0.4 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.0.3 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.0.2 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.7.0 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.6.7 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.6.6 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.6.5 lib/web_translate_it/auto_fetch.rb
wti_gettext_i18n_rails-1.0.3 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.6.4 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.6.3 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.6.2 lib/web_translate_it/auto_fetch.rb
wti_gettext_i18n_rails-1.0.2 lib/web_translate_it/auto_fetch.rb
wti_gettext_i18n_rails-1.0.1 lib/web_translate_it/auto_fetch.rb
wti_gettext_i18n_rails-1.0.0 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.6.1 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.6.0 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.5.2 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.5.1 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.5.0 lib/web_translate_it/auto_fetch.rb
web_translate_it-1.4.7 lib/web_translate_it/auto_fetch.rb