gitlab-org--gitlab-foss/lib/gitlab/ci/config/loader.rb
2017-03-01 15:28:10 +00:00

25 lines
476 B
Ruby

module Gitlab
module Ci
class Config
class Loader
FormatError = Class.new(StandardError)
def initialize(config)
@config = YAML.safe_load(config, [Symbol], [], true)
end
def valid?
@config.is_a?(Hash)
end
def load!
unless valid?
raise FormatError, 'Invalid configuration format'
end
@config.deep_symbolize_keys
end
end
end
end
end