Sha256: 8a61f52d1398b1817e414d945eaa3c65081160f5aab582523a022e1929114ab4

Contents?: true

Size: 814 Bytes

Versions: 2

Compression:

Stored size: 814 Bytes

Contents

# frozen_string_literal: true

module LoggableActivity
  # This class is used to load the configuration file located at config/loggable_activity.yml
  class Configuration
    # Loads the configuration file
    def self.load_config_file(config_file_path)
      @config_data = YAML.load_file(config_file_path)
    end

    # Returns the configuration data for the given class
    #
    # Example:
    #   LoggableActivity::Configuration.for_class('User')
    # Returns:
    #   {
    #     "record_display_name": "full_name",
    #     "loggable_attrs": [
    #       "first_name",
    #       "last_name",
    #     ],
    #     "auto_log": [
    #       "create",
    #       "update",
    #       "destroy"
    #     ]
    #   }
    def self.for_class(class_name)
      @config_data[class_name]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
loggable_activity-0.1.56 lib/loggable_activity/configuration.rb
loggable_activity-0.1.55 lib/loggable_activity/configuration.rb