class Resqued::Config::Base

Base class for config handlers.

Public Instance Methods

apply(str, filename = "INLINE") click to toggle source

Public: Apply the configuration in ‘str`.

Currently, this is a simple wrapper around ‘instance_eval`.

# File lib/resqued/config/base.rb, line 13
def apply(str, filename = "INLINE")
  instance_eval(str, filename)
  results
end
apply_all(configs) click to toggle source

Public: Apply the configuration from several files.

# File lib/resqued/config/base.rb, line 19
def apply_all(configs)
  configs.each do |config|
    with_current_path(config[:path]) do
      instance_eval(config[:content], config[:path])
    end
  end
  results
end

Private Instance Methods

require_relative(path) click to toggle source

Private: Override require_relative to work around bugs.ruby-lang.org/issues/4487

Calls superclass method
# File lib/resqued/config/base.rb, line 43
def require_relative(path)
  if @current_path
    require File.expand_path(path, File.dirname(@current_path))
  else
    super
  end
end
results() click to toggle source

Private: The results of applying the config.

# File lib/resqued/config/base.rb, line 31
def results
end
with_current_path(path) { || ... } click to toggle source

Private: Set a base path for require_relative.

# File lib/resqued/config/base.rb, line 35
def with_current_path(path)
  @current_path, old_current_path = path, @current_path
  yield
ensure
  @current_path = old_current_path
end