Sha256: 3fa0d3faed043a4eaa93e5ad8721c5b6283309364d4b99ff4c36dc904eb857ce

Contents?: true

Size: 674 Bytes

Versions: 4

Compression:

Stored size: 674 Bytes

Contents

require 'singleton'

module Draftsman
  class Config
    include Singleton
    attr_accessor :serializer, :timestamp_field, :whodunnit_field, :stash_drafted_changes
    alias :stash_drafted_changes? :stash_drafted_changes

    def initialize
      @timestamp_field = :created_at
      @mutex = Mutex.new
      @serializer = Draftsman::Serializers::Yaml
      @enabled = true
      @whodunnit_field = :whodunnit
      @stash_drafted_changes = true
    end

    # Indicates whether Draftsman is on or off. Default: true.
    def enabled
      @mutex.synchronize { !!@enabled }
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
draftsman-0.7.2 lib/draftsman/config.rb
draftsman-0.7.1 lib/draftsman/config.rb
draftsman-0.7.0 lib/draftsman/config.rb
draftsman-0.6.0 lib/draftsman/config.rb