Module: EffectiveLogging

Defined in:
lib/effective_logging.rb,
lib/effective_logging/engine.rb,
lib/effective_logging/version.rb,
lib/effective_logging/user_logger.rb,
lib/effective_logging/email_logger.rb,
lib/effective_logging/log_page_views.rb,
lib/effective_logging/log_changes_user.rb,
lib/effective_logging/active_record_logger.rb,
lib/generators/effective_logging/install_generator.rb

Defined Under Namespace

Modules: Generators, LogChangesUser, LogPageViews Classes: ActiveRecordLogger, EmailLogger, Engine, UserLogger

Constant Summary collapse

VERSION =
'1.7.0'.freeze

Class Method Summary collapse

Class Method Details

.authorized?(controller, action, resource) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
# File 'lib/effective_logging.rb', line 24

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

.current_userObject



56
57
58
# File 'lib/effective_logging.rb', line 56

def self.current_user
  @effective_logging_current_user
end

.current_user=(user) ⇒ Object

This is set by the “set_effective_logging_current_user” before_filter.



52
53
54
# File 'lib/effective_logging.rb', line 52

def self.current_user=(user)
  @effective_logging_current_user = user
end

.log_changes_statusObject



43
44
45
# File 'lib/effective_logging.rb', line 43

def self.log_changes_status
  'logged change'.freeze
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



20
21
22
# File 'lib/effective_logging.rb', line 20

def self.setup
  yield self
end

.statusesObject



39
40
41
# File 'lib/effective_logging.rb', line 39

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

.supressed(&block) ⇒ Object



31
32
33
# File 'lib/effective_logging.rb', line 31

def self.supressed(&block)
  @supressed = true; yield; @supressed = false
end

.supressed?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/effective_logging.rb', line 35

def self.supressed?
  @supressed == true
end

.trashable_statusObject



47
48
49
# File 'lib/effective_logging.rb', line 47

def self.trashable_status
  'trashed'.freeze
end