lib/datacaster/predefined.rb in datacaster-3.3.1 vs lib/datacaster/predefined.rb in datacaster-4.0.1
- old
+ new
@@ -159,11 +159,11 @@
end
end
end
def pass
- transform(&:itself)
+ cast { |v| Datacaster::ValidResult(v) }
end
def pass_if(base)
ContextNodes::PassIf.new(base)
end
@@ -187,19 +187,20 @@
else
from[key]
end
end
- must_be(Enumerable) & transform { |input|
+ must_be(Enumerable) & cast { |input|
result =
keys.map do |key|
Array(key).reduce(input) do |result, k|
result = retrieve_key.(result, k)
break result if result == Datacaster.absent
result
end
end
- keys.length == 1 ? result.first : result
+ result = keys.length == 1 ? result.first : result
+ Datacaster::ValidResult(result)
}
end
def relate(left, op, right, error_key: nil)
error_keys = ['.relate', 'datacaster.errors.relate']