Class: Journaled::AuditLog::Config

Inherits:
Struct
  • Object
show all
Defined in:
lib/journaled/audit_log.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



85
86
87
88
89
# File 'lib/journaled/audit_log.rb', line 85

def initialize(*)
  super
  self.ignored_columns ||= []
  self.enqueue_opts ||= {}
end

Instance Attribute Details

#enabled=(value) ⇒ Object

Sets the attribute enabled

Parameters:

  • value (Object)

    the value to set the attribute enabled to.

Returns:

  • (Object)

    the newly set value



80
81
82
# File 'lib/journaled/audit_log.rb', line 80

def enabled=(value)
  @enabled = value
end

#enqueue_optsObject

Returns the value of attribute enqueue_opts

Returns:

  • (Object)

    the current value of enqueue_opts



80
81
82
# File 'lib/journaled/audit_log.rb', line 80

def enqueue_opts
  @enqueue_opts
end

#ignored_columnsObject

Returns the value of attribute ignored_columns

Returns:

  • (Object)

    the current value of ignored_columns



80
81
82
# File 'lib/journaled/audit_log.rb', line 80

def ignored_columns
  @ignored_columns
end

Class Method Details

.defaultObject



81
82
83
# File 'lib/journaled/audit_log.rb', line 81

def self.default
  new(false, AuditLog.default_ignored_columns.dup, AuditLog.default_enqueue_opts.dup)
end

Instance Method Details

#dupObject



95
96
97
98
99
100
# File 'lib/journaled/audit_log.rb', line 95

def dup
  super.tap do |config|
    config.ignored_columns = ignored_columns.dup # rubocop:disable Rails/IgnoredColumnsAssignment
    config.enqueue_opts = enqueue_opts.dup
  end
end

#enabled?Boolean

Returns:

  • (Boolean)


91
92
93
# File 'lib/journaled/audit_log.rb', line 91

def enabled?
  !AuditLog._disabled && self[:enabled].present?
end