Class: DutyFree::Config
- Inherits:
-
Object
- Object
- DutyFree::Config
- Includes:
- Singleton
- Defined in:
- lib/duty_free/config.rb
Overview
Global configuration affecting all threads. Some thread-specific configuration can be found in ‘duty_free.rb`, others in `controller.rb`.
Instance Attribute Summary collapse
-
#association_reify_error_behaviour ⇒ Object
Returns the value of attribute association_reify_error_behaviour.
-
#object_changes_adapter ⇒ Object
Returns the value of attribute object_changes_adapter.
-
#root_model ⇒ Object
Returns the value of attribute root_model.
-
#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 DutyFree 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.
14 15 16 17 18 19 20 21 |
# File 'lib/duty_free/config.rb', line 14 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 = DutyFree::Serializers::YAML end |
Instance Attribute Details
#association_reify_error_behaviour ⇒ Object
Returns the value of attribute association_reify_error_behaviour.
11 12 13 |
# File 'lib/duty_free/config.rb', line 11 def association_reify_error_behaviour @association_reify_error_behaviour end |
#object_changes_adapter ⇒ Object
Returns the value of attribute object_changes_adapter.
11 12 13 |
# File 'lib/duty_free/config.rb', line 11 def object_changes_adapter @object_changes_adapter end |
#root_model ⇒ Object
Returns the value of attribute root_model.
11 12 13 |
# File 'lib/duty_free/config.rb', line 11 def root_model @root_model end |
#serializer ⇒ Object
Returns the value of attribute serializer.
11 12 13 |
# File 'lib/duty_free/config.rb', line 11 def serializer @serializer end |
#version_limit ⇒ Object
Returns the value of attribute version_limit.
11 12 13 |
# File 'lib/duty_free/config.rb', line 11 def version_limit @version_limit end |
Instance Method Details
#enabled ⇒ Object
Indicates whether DutyFree is on or off. Default: true.
24 25 26 |
# File 'lib/duty_free/config.rb', line 24 def enabled @mutex.synchronize { !!@enabled } end |
#enabled=(enable) ⇒ Object
28 29 30 |
# File 'lib/duty_free/config.rb', line 28 def enabled=(enable) @mutex.synchronize { @enabled = enable } end |