Sha256: ea626e92a944a61b677b762b143957f6ca82022846752b5c5dc6b6a48fd7a628

Contents?: true

Size: 958 Bytes

Versions: 7

Compression:

Stored size: 958 Bytes

Contents

require "effective_logging/engine"
require "effective_logging/version"
require "effective_logging/log_page_views"
require "effective_logging/user_logger"

module EffectiveLogging
  # The following are all valid config keys
  mattr_accessor :logs_table_name
  mattr_accessor :use_active_admin

  mattr_accessor :authorization_method
  mattr_accessor :layout
  mattr_accessor :additional_statuses

  mattr_accessor :emails_enabled
  mattr_accessor :user_logins_enabled

  def self.setup
    yield self
  end

  def self.authorized?(controller, action, resource)
    if authorization_method.respond_to?(:call) || authorization_method.kind_of?(Symbol)
      raise Effective::AccessDenied.new() unless (controller || self).instance_exec(controller, action, resource, &authorization_method)
    end
    true
  end

  def self.statuses
    @statuses ||= (Array(@@additional_statuses).map { |status| status.to_s.downcase } | ['info', 'success', 'error'])
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
effective_logging-1.2.3 lib/effective_logging.rb
effective_logging-1.2.2 lib/effective_logging.rb
effective_logging-1.2.1 lib/effective_logging.rb
effective_logging-1.2.0 lib/effective_logging.rb
effective_logging-1.1.3 lib/effective_logging.rb
effective_logging-1.1.2 lib/effective_logging.rb
effective_logging-1.1.0 lib/effective_logging.rb