class HerdstWorker::Configuration::Facade

Attributes

actions[RW]
env[RW]
metadata[RW]
paths[RW]

Public Class Methods

new(env, name) click to toggle source
# File lib/herdst_worker/configuration/facade.rb, line 16
def initialize(env, name)
    self.env = env.downcase
    
    self.paths = Paths.new
    self.metadata = Metadata.new(env, name, self)
    self.actions = self.config_for(:actions)
end

Public Instance Methods

config_for(name) click to toggle source
# File lib/herdst_worker/configuration/facade.rb, line 25
def config_for(name)
    file = "#{self.paths.config}/#{name}.yml"
    file_contents = ERB.new(File.new(file).read)
    yaml = YAML.load(file_contents.result(binding)).with_indifferent_access
    
    yaml.include?(self.env) ? yaml[self.env] : yaml
end
is_dev?() click to toggle source
# File lib/herdst_worker/configuration/facade.rb, line 44
def is_dev?
    self.env == "development"
end
is_prod?() click to toggle source
# File lib/herdst_worker/configuration/facade.rb, line 34
def is_prod?
    self.env == "production"
end
is_test?() click to toggle source
# File lib/herdst_worker/configuration/facade.rb, line 39
def is_test?
    self.env == "test"
end