Class: Retry

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

Overview

The conditions for retrying this step.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



965
966
967
968
969
970
971
# File 'lib/schema.rb', line 965

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    automatic: d["automatic"] ? Automatic.from_dynamic!(d["automatic"]) : nil,
    manual: d["manual"] ? ManualUnion.from_dynamic!(d["manual"]) : nil
  )
end

.from_json!(json) ⇒ Object



973
974
975
# File 'lib/schema.rb', line 973

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

Instance Method Details

#to_dynamicObject



977
978
979
980
981
982
# File 'lib/schema.rb', line 977

def to_dynamic
  {
    "automatic" => automatic&.to_dynamic,
    "manual" => manual&.to_dynamic
  }
end

#to_json(options = nil) ⇒ Object



984
985
986
# File 'lib/schema.rb', line 984

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