Class: AutomaticRetryExitStatus

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

Overview

The exit status number that will cause this job to retry

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



751
752
753
754
755
756
757
# File 'lib/schema.rb', line 751

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

  raise "Invalid union"
end

.from_json!(json) ⇒ Object



759
760
761
# File 'lib/schema.rb', line 759

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

Instance Method Details

#to_dynamicObject



763
764
765
766
767
768
769
770
771
# File 'lib/schema.rb', line 763

def to_dynamic
  if !enum.nil?
    enum
  elsif !integer.nil?
    integer
  elsif !integer_array.nil?
    integer_array
  end
end

#to_json(options = nil) ⇒ Object



773
774
775
# File 'lib/schema.rb', line 773

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