Welcome to mirror list, hosted at ThFree Co, Russian Federation.

result.rb « yaml « config « ci « gitlab « lib - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 1a3ca53c161f7d1e6d6d613676a29e43a97e0ca6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# frozen_string_literal: true

module Gitlab
  module Ci
    class Config
      module Yaml
        class Result
          attr_reader :error

          def initialize(config: nil, error: nil)
            @config = Array.wrap(config)
            @error = error
          end

          def valid?
            error.nil?
          end

          def has_header?
            @config.size > 1
          end

          def header
            raise ArgumentError unless has_header?

            @config.first
          end

          def content
            @config.last
          end
        end
      end
    end
  end
end