Class: Ci::PipelineCreation::PushOptions
- Inherits:
-
Object
- Object
- Ci::PipelineCreation::PushOptions
- Defined in:
- lib/ci/pipeline_creation/push_options.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(push_options) ⇒ PushOptions
constructor
A new instance of PushOptions.
- #inputs ⇒ Object
- #skips_ci? ⇒ Boolean
- #variables ⇒ Object
Constructor Details
#initialize(push_options) ⇒ PushOptions
Returns a new instance of PushOptions.
18 19 20 |
# File 'lib/ci/pipeline_creation/push_options.rb', line 18 def initialize() @push_options = &.deep_symbolize_keys || {} end |
Class Method Details
.fabricate(push_options) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/ci/pipeline_creation/push_options.rb', line 6 def self.fabricate() if .is_a?(self) elsif .is_a?(Hash) new() elsif .blank? new({}) else raise ArgumentError, 'Unknown type of push_option' end end |
Instance Method Details
#inputs ⇒ Object
37 38 39 40 41 42 |
# File 'lib/ci/pipeline_creation/push_options.rb', line 37 def inputs = .dig(:ci, :input) return {} unless extract_key_value_pairs_from_push_option().to_h end |
#skips_ci? ⇒ Boolean
22 23 24 |
# File 'lib/ci/pipeline_creation/push_options.rb', line 22 def skips_ci? .dig(:ci, :skip).present? end |
#variables ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/ci/pipeline_creation/push_options.rb', line 26 def variables = .dig(:ci, :variable) return [] unless raw_vars = extract_key_value_pairs_from_push_option() raw_vars.map do |key, value| { "key" => key, "variable_type" => "env_var", "secret_value" => value } end end |