Sha256: 6573a5648454d643b01d557fc5a580fcfad2db3e2330e4ebec49298c55bd50ee

Contents?: true

Size: 760 Bytes

Versions: 9

Compression:

Stored size: 760 Bytes

Contents

# frozen_string_literal: true

require 'rails'

module Mnemosyne
  class Railtie < ::Rails::Railtie
    initializer 'mnemosyne.initialize' do |app|
      config = app.config_for('mnemosyne')

      ::Mnemosyne::Logging.logger = Rails.logger

      config['application'] ||= app.class.name.underscore.titleize

      # If server is configured mnemosyne should be enabled by default
      config['enabled'] = config.key?('server') unless config.key?('enabled')

      config = ::Mnemosyne::Configuration.new(config)

      if config.enabled?
        ::Mnemosyne::Instrumenter.start!(config)

        app.middleware.insert 0, ::Mnemosyne::Middleware::Rack
      else
        Rails.logger.warn(Mnemosyne) { 'Instrumentation disabled' }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
mnemosyne-ruby-1.7.1 lib/mnemosyne/railtie.rb
mnemosyne-ruby-1.7.0 lib/mnemosyne/railtie.rb
mnemosyne-ruby-1.6.2 lib/mnemosyne/railtie.rb
mnemosyne-ruby-1.6.1 lib/mnemosyne/railtie.rb
mnemosyne-ruby-1.5.1 lib/mnemosyne/railtie.rb
mnemosyne-ruby-1.5.0 lib/mnemosyne/railtie.rb
mnemosyne-ruby-1.4.0 lib/mnemosyne/railtie.rb
mnemosyne-ruby-1.3.0 lib/mnemosyne/railtie.rb
mnemosyne-ruby-1.2.1 lib/mnemosyne/railtie.rb