Class: Gitlab::Ci::Config::Yaml::Loader
- Inherits:
-
Object
- Object
- Gitlab::Ci::Config::Yaml::Loader
- Includes:
- Utils::StrongMemoize
- Defined in:
- lib/gitlab/ci/config/yaml/loader.rb
Constant Summary collapse
Instance Method Summary collapse
-
#initialize(content, inputs: {}) ⇒ Loader
constructor
A new instance of Loader.
- #load ⇒ Object
Constructor Details
#initialize(content, inputs: {}) ⇒ Loader
Returns a new instance of Loader.
13 14 15 16 |
# File 'lib/gitlab/ci/config/yaml/loader.rb', line 13 def initialize(content, inputs: {}) @content = content @inputs = inputs end |
Instance Method Details
#load ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/gitlab/ci/config/yaml/loader.rb', line 18 def load yaml_result = load_uninterpolated_yaml return yaml_result unless yaml_result.valid? interpolator = Interpolation::Interpolator.new(yaml_result, inputs) interpolator.interpolate! if interpolator.valid? # This Result contains only the interpolated config and does not have a header Yaml::Result.new(config: interpolator.to_hash, error: nil, interpolated: interpolator.interpolated?) else Yaml::Result.new(error: interpolator., interpolated: interpolator.interpolated?) end end |