Class: SoftFailElement

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



1137
1138
1139
1140
1141
1142
# File 'lib/schema.rb', line 1137

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    exit_status: d["exit_status"] ? SoftFailExitStatus.from_dynamic!(d["exit_status"]) : nil
  )
end

.from_json!(json) ⇒ Object



1144
1145
1146
# File 'lib/schema.rb', line 1144

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

Instance Method Details

#to_dynamicObject



1148
1149
1150
1151
1152
# File 'lib/schema.rb', line 1148

def to_dynamic
  {
    "exit_status" => exit_status&.to_dynamic
  }
end

#to_json(options = nil) ⇒ Object



1154
1155
1156
# File 'lib/schema.rb', line 1154

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