Sha256: e7bbd4c15f7174d48637988f70c7c1df60597e55d4e4af1addf38e289e3f0efe

Contents?: true

Size: 1.09 KB

Versions: 3

Compression:

Stored size: 1.09 KB

Contents

require 'singleton'

module PaperTrailScrapbook
  # Global configuration affecting all threads.
  class Config
    include Singleton

    DEFAULT_TIME_FORMAT = '%A, %d %b %Y at %l:%M %p'.freeze
    DEFAULT_EVENTS      = { 'create'  => 'created',
                            'update'  => 'updated',
                            'destroy' => 'destroyed' }.freeze

    SCRUB_COLUMNS     = %w[updated_at created_at id].freeze
    UNKNOWN_WHODUNNIT = '*the app*'.freeze

    attr_accessor :whodunnit_class,
                  :time_format,
                  :events,
                  :scrub_columns,
                  :drop_id_suffix,
                  :unknown_whodunnit,
                  :invalid_whodunnit,
                  :filter_non_changes

    def initialize
      @whodunnit_class    = nil
      @time_format        = DEFAULT_TIME_FORMAT
      @events             = DEFAULT_EVENTS
      @scrub_columns      = SCRUB_COLUMNS
      @unknown_whodunnit  = UNKNOWN_WHODUNNIT
      @invalid_whodunnit  = proc { |w| "*missing (#{w})*" }
      @drop_id_suffix     = true
      @filter_non_changes = true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
paper_trail_scrapbook-0.1.9 lib/paper_trail_scrapbook/config.rb
paper_trail_scrapbook-0.1.8 lib/paper_trail_scrapbook/config.rb
paper_trail_scrapbook-0.1.7 lib/paper_trail_scrapbook/config.rb