class EcsOneshot::Config

Public Class Methods

load(path, env) click to toggle source
# File lib/ecs_oneshot/config.rb, line 15
def load(path, env)
  raise Error, "'#{path}' file not found." unless File.exist?(path)

  yaml = YAML.load_file(path)
  raise Error, "'#{env}' env not found." unless yaml.key?(env)

  options = yaml[env]
  new(**options)
end
safe_build(attributes) click to toggle source
# File lib/ecs_oneshot/config.rb, line 10
def safe_build(attributes)
  safe_attributes = attributes.slice(*members)
  new(**safe_attributes)
end

Public Instance Methods

merge(other) click to toggle source
# File lib/ecs_oneshot/config.rb, line 26
def merge(other)
  new_options = to_h.merge(other.to_h.compact)
  Config.new(**new_options)
end