lib/floe/workflow/path.rb in floe-0.11.3 vs lib/floe/workflow/path.rb in floe-0.12.0

- old
+ new

@@ -2,10 +2,14 @@ module Floe class Workflow class Path class << self + def path?(payload) + payload.start_with?("$") + end + def value(payload, context, input = {}) new(payload).value(context, input) end end @@ -24,11 +28,13 @@ [context, payload[1..]] else [input, payload] end - results = JsonPath.on(obj, path) + # If path is $ then just return the entire input + return obj if path == "$" + results = JsonPath.on(obj, path) results.count < 2 ? results.first : results end end end end