Class: Gitlab::Ci::Config::Yaml::Result
- Inherits:
-
Object
- Object
- Gitlab::Ci::Config::Yaml::Result
- Defined in:
- lib/gitlab/ci/config/yaml/result.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#error_class ⇒ Object
readonly
Returns the value of attribute error_class.
Instance Method Summary collapse
- #content ⇒ Object
- #has_header? ⇒ Boolean
- #header ⇒ Object
-
#initialize(config: nil, error: nil, error_class: nil, interpolated: false) ⇒ Result
constructor
A new instance of Result.
- #interpolated? ⇒ Boolean
- #valid? ⇒ Boolean
Constructor Details
#initialize(config: nil, error: nil, error_class: nil, interpolated: false) ⇒ Result
Returns a new instance of Result.
10 11 12 13 14 15 |
# File 'lib/gitlab/ci/config/yaml/result.rb', line 10 def initialize(config: nil, error: nil, error_class: nil, interpolated: false) @config = Array.wrap(config) @error = error @error_class = error_class @interpolated = interpolated end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
8 9 10 |
# File 'lib/gitlab/ci/config/yaml/result.rb', line 8 def error @error end |
#error_class ⇒ Object (readonly)
Returns the value of attribute error_class.
8 9 10 |
# File 'lib/gitlab/ci/config/yaml/result.rb', line 8 def error_class @error_class end |
Instance Method Details
#content ⇒ Object
37 38 39 40 41 |
# File 'lib/gitlab/ci/config/yaml/result.rb', line 37 def content return @config.last if has_header? @config.first || {} end |
#has_header? ⇒ Boolean
25 26 27 28 29 |
# File 'lib/gitlab/ci/config/yaml/result.rb', line 25 def has_header? return false unless @config.first.is_a?(Hash) @config.size > 1 && @config.first.key?(:spec) end |
#header ⇒ Object
31 32 33 34 35 |
# File 'lib/gitlab/ci/config/yaml/result.rb', line 31 def header raise ArgumentError unless has_header? @config.first end |
#interpolated? ⇒ Boolean
21 22 23 |
# File 'lib/gitlab/ci/config/yaml/result.rb', line 21 def interpolated? !!@interpolated end |
#valid? ⇒ Boolean
17 18 19 |
# File 'lib/gitlab/ci/config/yaml/result.rb', line 17 def valid? error.nil? end |