class DutyFree::Config

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

Attributes

association_reify_error_behaviour[RW]
object_changes_adapter[RW]
root_model[RW]
serializer[RW]
version_limit[RW]

Public Class Methods

new() click to toggle source
# 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

Public Instance Methods

enabled() click to toggle source

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

# File lib/duty_free/config.rb, line 24
def enabled
  @mutex.synchronize { !!@enabled }
end
enabled=(enable) click to toggle source
# File lib/duty_free/config.rb, line 28
def enabled=(enable)
  @mutex.synchronize { @enabled = enable }
end