Sha256: 8d50e87e9bae5044f3bc6ea33defe0acddc05a3632bdc9d544399f619faa6496

Contents?: true

Size: 1.11 KB

Versions: 4

Compression:

Stored size: 1.11 KB

Contents

# frozen_string_literal: true

require 'singleton'

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

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

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

    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

4 entries across 4 versions & 1 rubygems

Version Path
paper_trail_scrapbook-0.1.13 lib/paper_trail_scrapbook/config.rb
paper_trail_scrapbook-0.1.12 lib/paper_trail_scrapbook/config.rb
paper_trail_scrapbook-0.1.11 lib/paper_trail_scrapbook/config.rb
paper_trail_scrapbook-0.1.10 lib/paper_trail_scrapbook/config.rb