Sha256: 31d099c78819ca338db87cfec7b7aacf088c55d626302ca724c6ee77c1849f87
Contents?: true
Size: 635 Bytes
Versions: 11
Compression:
Stored size: 635 Bytes
Contents
# frozen_string_literal: true module Floe class Workflow class Path class << self def value(payload, context, input = {}) new(payload).value(context, input) end end def initialize(payload) @payload = payload end def value(context, input = {}) obj, path = if payload.start_with?("$$") [context, payload[1..]] else [input, payload] end results = JsonPath.on(obj, path) results.count < 2 ? results.first : results end private attr_reader :payload end end end
Version data entries
11 entries across 11 versions & 1 rubygems