Class: I18nAi::Railtie::I18nAiMiddleware

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_ai/railtie.rb

Overview

Initialize the I18nAi middleware

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ I18nAiMiddleware

Returns a new instance of I18nAiMiddleware.



16
17
18
19
20
# File 'lib/i18n_ai/railtie.rb', line 16

def initialize(app)
  @app = app
  @client = configure_client
  @last_checksum = nil
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



14
15
16
# File 'lib/i18n_ai/railtie.rb', line 14

def client
  @client
end

Instance Method Details

#call(env) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/i18n_ai/railtie.rb', line 22

def call(env)
  locales_file = locate_locales_file

  if file_exists?(locales_file)
    process_locales_file(locales_file)
  else
    log_file_not_found
  end

  @app.call(env)
end