Method: CopycopterClient::Configuration#apply

Defined in:
lib/copycopter_client/configuration.rb

#applyObject

Applies the configuration (internal).

Called automatically when CopycopterClient.configure is called in the application.

This creates the I18nBackend and puts them together.

When #test? returns false, the poller will be started.



166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/copycopter_client/configuration.rb', line 166

def apply
  self.client ||= Client.new(to_hash)
  self.cache ||= Cache.new(client, to_hash)
  poller = Poller.new(cache, to_hash)
  process_guard = ProcessGuard.new(cache, poller, to_hash)
  I18n.backend = I18nBackend.new(cache)

  if middleware && development?
    middleware.use RequestSync, :cache => cache
  end

  @applied = true
  logger.info "Client #{VERSION} ready"
  logger.info "Environment Info: #{environment_info}"

  unless test?
    process_guard.start
  end
end