Class: PaperTrail::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/paper_trail/config.rb

Overview

Global configuration affecting all threads. Some thread-specific configuration can be found in ‘paper_trail.rb`, others in `controller.rb`.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



20
21
22
23
24
25
26
27
28
# File 'lib/paper_trail/config.rb', line 20

def initialize
  # Variables which affect all threads, whose access is synchronized.
  @mutex = Mutex.new
  @enabled = true

  # Variables which affect all threads, whose access is *not* synchronized.
  @serializer = PaperTrail::Serializers::YAML
  @has_paper_trail_defaults = {}
end

Instance Attribute Details

#association_reify_error_behaviourObject

Returns the value of attribute association_reify_error_behaviour.



12
13
14
# File 'lib/paper_trail/config.rb', line 12

def association_reify_error_behaviour
  @association_reify_error_behaviour
end

#has_paper_trail_defaultsObject

Returns the value of attribute has_paper_trail_defaults.



12
13
14
# File 'lib/paper_trail/config.rb', line 12

def has_paper_trail_defaults
  @has_paper_trail_defaults
end

#object_changes_adapterObject

Returns the value of attribute object_changes_adapter.



12
13
14
# File 'lib/paper_trail/config.rb', line 12

def object_changes_adapter
  @object_changes_adapter
end

#serializerObject

Returns the value of attribute serializer.



12
13
14
# File 'lib/paper_trail/config.rb', line 12

def serializer
  @serializer
end

#version_limitObject

Returns the value of attribute version_limit.



12
13
14
# File 'lib/paper_trail/config.rb', line 12

def version_limit
  @version_limit
end

Instance Method Details

#enabledObject

Indicates whether PaperTrail is on or off. Default: true.



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

def enabled
  @mutex.synchronize { !!@enabled }
end

#enabled=(enable) ⇒ Object



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

def enabled=(enable)
  @mutex.synchronize { @enabled = enable }
end