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



963
964
965
966
967
968
969
# File 'lib/schema.rb', line 963

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



971
972
973
# File 'lib/schema.rb', line 971

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

Instance Method Details

#to_dynamicObject



975
976
977
978
979
980
# File 'lib/schema.rb', line 975

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

#to_json(options = nil) ⇒ Object



982
983
984
# File 'lib/schema.rb', line 982

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