Class: Skip
- Inherits:
-
Dry::Struct
- Object
- Dry::Struct
- Skip
- Defined in:
- lib/schema.rb
Overview
Whether this step should be skipped. Passing a string provides a reason for skipping this command
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.from_dynamic!(d) ⇒ Object
1082 1083 1084 1085 1086 1087 |
# File 'lib/schema.rb', line 1082 def self.from_dynamic!(d) return new(bool: d, string: nil) if schema[:bool].right.valid? d return new(string: d, bool: nil) if schema[:string].right.valid? d raise "Invalid union" end |
.from_json!(json) ⇒ Object
1089 1090 1091 |
# File 'lib/schema.rb', line 1089 def self.from_json!(json) from_dynamic!(JSON.parse(json)) end |
Instance Method Details
#to_dynamic ⇒ Object
1093 1094 1095 1096 1097 1098 1099 |
# File 'lib/schema.rb', line 1093 def to_dynamic if !bool.nil? bool elsif !string.nil? string end end |
#to_json(options = nil) ⇒ Object
1101 1102 1103 |
# File 'lib/schema.rb', line 1101 def to_json( = nil) JSON.generate(to_dynamic, ) end |