Class: Branches

Inherits:
Dry::Struct
  • Object
show all
Defined in:
lib/schema.rb

Overview

Which branches will include this step in their builds

The value of the option(s) that will be pre-selected in the dropdown

The glob path/s of artifacts to upload once this step has finished running

The commands to run on the agent

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



286
287
288
289
290
291
# File 'lib/schema.rb', line 286

def self.from_dynamic!(d)
  return new(string: d, string_array: nil) if schema[:string].right.valid? d
  return new(string_array: d, string: nil) if schema[:string_array].right.valid? d

  raise "Invalid union"
end

.from_json!(json) ⇒ Object



293
294
295
# File 'lib/schema.rb', line 293

def self.from_json!(json)
  from_dynamic!(JSON.parse(json))
end

Instance Method Details

#to_dynamicObject



297
298
299
300
301
302
303
# File 'lib/schema.rb', line 297

def to_dynamic
  if !string.nil?
    string
  elsif !string_array.nil?
    string_array
  end
end

#to_json(options = nil) ⇒ Object



305
306
307
# File 'lib/schema.rb', line 305

def to_json(options = nil)
  JSON.generate(to_dynamic, options)
end