Class: Draftsman::Config

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/draftsman/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



9
10
11
12
13
14
15
16
# File 'lib/draftsman/config.rb', line 9

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

Instance Attribute Details

#serializerObject

Returns the value of attribute serializer.



6
7
8
# File 'lib/draftsman/config.rb', line 6

def serializer
  @serializer
end

#stash_drafted_changesObject Also known as: stash_drafted_changes?

Returns the value of attribute stash_drafted_changes.



6
7
8
# File 'lib/draftsman/config.rb', line 6

def stash_drafted_changes
  @stash_drafted_changes
end

#timestamp_fieldObject

Returns the value of attribute timestamp_field.



6
7
8
# File 'lib/draftsman/config.rb', line 6

def timestamp_field
  @timestamp_field
end

#whodunnit_fieldObject

Returns the value of attribute whodunnit_field.



6
7
8
# File 'lib/draftsman/config.rb', line 6

def whodunnit_field
  @whodunnit_field
end

Instance Method Details

#enabledObject

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



19
20
21
# File 'lib/draftsman/config.rb', line 19

def enabled
  @mutex.synchronize { !!@enabled }
end

#enabled=(enable) ⇒ Object



23
24
25
# File 'lib/draftsman/config.rb', line 23

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