Class: AutomaticRetry

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_dynamic!(d) ⇒ Object



802
803
804
805
806
807
808
809
810
# File 'lib/schema.rb', line 802

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    exit_status: d["exit_status"] ? AutomaticRetryExitStatus.from_dynamic!(d["exit_status"]) : nil,
    limit: d["limit"],
    signal: d["signal"],
    signal_reason: d["signal_reason"]
  )
end

.from_json!(json) ⇒ Object



812
813
814
# File 'lib/schema.rb', line 812

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

Instance Method Details

#to_dynamicObject



816
817
818
819
820
821
822
823
# File 'lib/schema.rb', line 816

def to_dynamic
  {
    "exit_status" => exit_status&.to_dynamic,
    "limit" => limit,
    "signal" => signal,
    "signal_reason" => signal_reason
  }
end

#to_json(options = nil) ⇒ Object



825
826
827
# File 'lib/schema.rb', line 825

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