Class: SnailTrail::Config
- Inherits:
-
Object
- Object
- SnailTrail::Config
- Includes:
- Singleton
- Defined in:
- lib/snail_trail/config.rb
Overview
Global configuration affecting all threads. Some thread-specific configuration can be found in ‘snail_trail.rb`, others in `controller.rb`.
Instance Attribute Summary collapse
-
#has_snail_trail_defaults ⇒ Object
Returns the value of attribute has_snail_trail_defaults.
-
#object_changes_adapter ⇒ Object
Returns the value of attribute object_changes_adapter.
-
#serializer ⇒ Object
Returns the value of attribute serializer.
-
#version_error_behavior ⇒ Object
Returns the value of attribute version_error_behavior.
-
#version_limit ⇒ Object
Returns the value of attribute version_limit.
Instance Method Summary collapse
-
#enabled ⇒ Object
Indicates whether SnailTrail 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.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/snail_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 = SnailTrail::Serializers::YAML @has_snail_trail_defaults = {} @version_error_behavior = :legacy end |
Instance Attribute Details
#has_snail_trail_defaults ⇒ Object
Returns the value of attribute has_snail_trail_defaults.
12 13 14 |
# File 'lib/snail_trail/config.rb', line 12 def has_snail_trail_defaults @has_snail_trail_defaults end |
#object_changes_adapter ⇒ Object
Returns the value of attribute object_changes_adapter.
12 13 14 |
# File 'lib/snail_trail/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/snail_trail/config.rb', line 12 def serializer @serializer end |
#version_error_behavior ⇒ Object
Returns the value of attribute version_error_behavior.
12 13 14 |
# File 'lib/snail_trail/config.rb', line 12 def version_error_behavior @version_error_behavior end |
#version_limit ⇒ Object
Returns the value of attribute version_limit.
12 13 14 |
# File 'lib/snail_trail/config.rb', line 12 def version_limit @version_limit end |
Instance Method Details
#enabled ⇒ Object
Indicates whether SnailTrail is on or off. Default: true.
32 33 34 |
# File 'lib/snail_trail/config.rb', line 32 def enabled @mutex.synchronize { !!@enabled } end |
#enabled=(enable) ⇒ Object
36 37 38 |
# File 'lib/snail_trail/config.rb', line 36 def enabled=(enable) @mutex.synchronize { @enabled = enable } end |