Class: PaperTrail::Config
- Inherits:
-
Object
- Object
- PaperTrail::Config
- Includes:
- Singleton
- Defined in:
- lib/mongo_trails/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
-
#association_reify_error_behaviour ⇒ Object
Returns the value of attribute association_reify_error_behaviour.
-
#has_paper_trail_defaults ⇒ Object
Returns the value of attribute has_paper_trail_defaults.
-
#mongo_config ⇒ Object
Returns the value of attribute mongo_config.
-
#mongo_prefix ⇒ Object
Returns the value of attribute mongo_prefix.
-
#object_changes_adapter ⇒ Object
Returns the value of attribute object_changes_adapter.
-
#serializer ⇒ Object
Returns the value of attribute serializer.
-
#version_limit ⇒ Object
Returns the value of attribute version_limit.
Instance Method Summary collapse
-
#enabled ⇒ Object
Indicates whether PaperTrail is on or off.
- #enabled=(enable) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
22 23 24 25 26 27 28 29 30 |
# File 'lib/mongo_trails/config.rb', line 22 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_behaviour ⇒ Object
Returns the value of attribute association_reify_error_behaviour.
12 13 14 |
# File 'lib/mongo_trails/config.rb', line 12 def association_reify_error_behaviour @association_reify_error_behaviour end |
#has_paper_trail_defaults ⇒ Object
Returns the value of attribute has_paper_trail_defaults.
12 13 14 |
# File 'lib/mongo_trails/config.rb', line 12 def has_paper_trail_defaults @has_paper_trail_defaults end |
#mongo_config ⇒ Object
Returns the value of attribute mongo_config.
12 13 14 |
# File 'lib/mongo_trails/config.rb', line 12 def mongo_config @mongo_config end |
#mongo_prefix ⇒ Object
Returns the value of attribute mongo_prefix.
12 13 14 |
# File 'lib/mongo_trails/config.rb', line 12 def mongo_prefix @mongo_prefix end |
#object_changes_adapter ⇒ Object
Returns the value of attribute object_changes_adapter.
12 13 14 |
# File 'lib/mongo_trails/config.rb', line 12 def object_changes_adapter @object_changes_adapter end |
#serializer ⇒ Object
Returns the value of attribute serializer.
12 13 14 |
# File 'lib/mongo_trails/config.rb', line 12 def serializer @serializer end |
#version_limit ⇒ Object
Returns the value of attribute version_limit.
12 13 14 |
# File 'lib/mongo_trails/config.rb', line 12 def version_limit @version_limit end |
Instance Method Details
#enabled ⇒ Object
Indicates whether PaperTrail is on or off. Default: true.
33 34 35 |
# File 'lib/mongo_trails/config.rb', line 33 def enabled @mutex.synchronize { !!@enabled } end |
#enabled=(enable) ⇒ Object
37 38 39 |
# File 'lib/mongo_trails/config.rb', line 37 def enabled=(enable) @mutex.synchronize { @enabled = enable } end |