I need an either_of filter. It should accept a hash of values where exactly one key of the listed if filled:
either_of do
hash :a do
string :f1
end
hash :b do
string :f2
string :f3
end
hash :c do
string :f4
string :f5
end
end
Valid:
{"a": { "f1": "qwe" }}
{"b": { "f2": "qwe", "f3": "wqe" }}
{"c": { "f4": "asd", "f5": "asd }}
Error:
{}
{"a": { "f1": "qwe" }, "b": { "f2": "qwe", "f3": "wqe" }}
{ "d": {} }
{ "a": { "f1": "qwe" }, "d": "qwe" }
What do you think?
I need an
either_offilter. It should accept a hash of values where exactly one key of the listed if filled:Valid:
{"a": { "f1": "qwe" }}{"b": { "f2": "qwe", "f3": "wqe" }}{"c": { "f4": "asd", "f5": "asd }}Error:
{}{"a": { "f1": "qwe" }, "b": { "f2": "qwe", "f3": "wqe" }}{ "d": {} }{ "a": { "f1": "qwe" }, "d": "qwe" }What do you think?