Class: DependsOnClass

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



325
326
327
328
329
330
331
# File 'lib/schema.rb', line 325

def self.from_dynamic!(d)
  d = Types::Hash[d]
  new(
    allow_failure: d["allow_failure"] ? AllowDependencyFailureUnion.from_dynamic!(d["allow_failure"]) : nil,
    step: d["step"]
  )
end

.from_json!(json) ⇒ Object



333
334
335
# File 'lib/schema.rb', line 333

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

Instance Method Details

#to_dynamicObject



337
338
339
340
341
342
# File 'lib/schema.rb', line 337

def to_dynamic
  {
    "allow_failure" => allow_failure&.to_dynamic,
    "step" => step
  }
end

#to_json(options = nil) ⇒ Object



344
345
346
# File 'lib/schema.rb', line 344

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