Sha256: 5df9f43e7440c2c35b88b0a1ebc35b7961718ad0f1f7721e3657cb257bcfb9fb

Contents?: true

Size: 857 Bytes

Versions: 3

Compression:

Stored size: 857 Bytes

Contents

require "activeadmin-settings/version"

module ActiveadminSettings
  require 'activeadmin-settings/engine'
  require 'activeadmin-settings/helper'

  def self.load_config
    config_file = ::Rails.root.join("config/activeadmin_settings.yml")
    @load_config = {}
    
    if File.exists?(config_file)
      data = YAML::load(ERB.new(IO.read(config_file)).result)
      @load_config = data if data
    end
  end

  def self.all_settings
    @all_settings = {}
    load_config.each do |key, settings|
      @all_settings.merge!(settings)
    end
    @all_settings
  end

  def self.groups
    @groups = []
    load_config.each do |key, settings|
      @groups << { :name     => key,
                  :slug     => key.downcase.gsub(" ", "_"),
                  :default_settings => settings,
                  :settings => [] }
    end
    @groups
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activeadmin-settings-0.2.3 lib/activeadmin-settings.rb
activeadmin-settings-0.2.2 lib/activeadmin-settings.rb
activeadmin-settings-0.2.1 lib/activeadmin-settings.rb