diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 11:10:13 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-06-20 11:10:13 +0000 |
commit | 0ea3fcec397b69815975647f5e2aa5fe944a8486 (patch) | |
tree | 7979381b89d26011bcf9bdc989a40fcc2f1ed4ff /lib/gitlab/static_site_editor/config/file_config.rb | |
parent | 72123183a20411a36d607d70b12d57c484394c8e (diff) | |
download | gitlab-ce-0ea3fcec397b69815975647f5e2aa5fe944a8486.tar.gz |
Add latest changes from gitlab-org/gitlab@15-1-stable-eev15.1.0-rc42
Diffstat (limited to 'lib/gitlab/static_site_editor/config/file_config.rb')
-rw-r--r-- | lib/gitlab/static_site_editor/config/file_config.rb | 42 |
1 files changed, 0 insertions, 42 deletions
diff --git a/lib/gitlab/static_site_editor/config/file_config.rb b/lib/gitlab/static_site_editor/config/file_config.rb deleted file mode 100644 index 4180f6ccf00..00000000000 --- a/lib/gitlab/static_site_editor/config/file_config.rb +++ /dev/null @@ -1,42 +0,0 @@ -# frozen_string_literal: true - -module Gitlab - module StaticSiteEditor - module Config - # - # Base GitLab Static Site Editor Configuration facade - # - class FileConfig - ConfigError = Class.new(StandardError) - - def initialize(yaml) - content_hash = content_hash(yaml) - @global = Entry::Global.new(content_hash) - @global.compose! - rescue Gitlab::Config::Loader::FormatError => e - raise FileConfig::ConfigError, e.message - end - - def valid? - @global.valid? - end - - def errors - @global.errors - end - - def to_hash_with_defaults - # NOTE: The current approach of simply mapping all the descendents' keys and values ('config') - # into a flat hash may need to be enhanced as we add more complex, non-scalar entries. - @global.descendants.to_h { |descendant| [descendant.key, descendant.config] } - end - - private - - def content_hash(yaml) - Gitlab::Config::Loader::Yaml.new(yaml).load! - end - end - end - end -end |