class LoadableConfig::Options

Attributes

config_path_prefix[R]
environment_key[R]
preprocessor[R]

Public Class Methods

new() click to toggle source
# File lib/loadable_config/options.rb, line 6
def initialize
  # Prefix for configuration file paths. Must be a valid directory, for
  # example `Rails.root`. If unset, configuration files are resolved relative
  # to the current working directory.
  @config_path_prefix = nil

  # If set, assumes that all LoadableConfig configuration files are structured
  # with top-level keys specifying different environments, each of which is a
  # hash of the configuration attributes. Setting this specifies which top
  # level key to select. For example, `Rails.env`.
  @environment_key     = nil

  # If set, uses the provided block to preprocess the configuration file
  # before YAML parsing.
  @preprocessor        = nil
end

Public Instance Methods

config_path_prefix=(val) click to toggle source
# File lib/loadable_config/options.rb, line 23
def config_path_prefix=(val)
  unless File.directory?(val)
    raise ArgumentError.new("Config path prefix '#{val}' is not a valid directory")
  end

  @config_path_prefix = File.expand_path(val)
end
environment_key=(val) click to toggle source
# File lib/loadable_config/options.rb, line 31
def environment_key=(val)
  @environment_key = val.to_s
end
preprocess(&block) click to toggle source
# File lib/loadable_config/options.rb, line 35
def preprocess(&block)
  @preprocessor = block
end