Class: BlockStepNotify
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- BlockStepNotify
- Defined in:
- lib/schema.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 |
# File 'lib/schema.rb', line 2009 def self.from_dynamic!(d) begin value = BuildNotify2.from_dynamic!(d) return new(build_notify2: value, enum: nil) if schema[:build_notify2].right.valid? value rescue StandardError end return new(enum: d, build_notify2: nil) if schema[:enum].right.valid? d raise "Invalid union" end |
.from_json!(json) ⇒ Object
2020 2021 2022 |
# File 'lib/schema.rb', line 2020 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
2024 2025 2026 2027 2028 2029 2030 |
# File 'lib/schema.rb', line 2024 def to_dynamic if !build_notify2.nil? build_notify2.to_dynamic elsif !enum.nil? enum end end |
#to_json(options = nil) ⇒ Object
2032 2033 2034 |
# File 'lib/schema.rb', line 2032 def to_json( = nil) JSON.generate(to_dynamic, ) end |