class Remap::Rule::Map::Path
Constants
- Input
Returns the value at a given path
@example Select “A” from { a: { b: { c: [“A”] } } }
state = Remap::State.call({ a: { b: { c: ["A"] } } }) first = Remap::Selector::Index.new(index: 0) path = Remap::Path::Input.new([:a, :b, :c, first]) path.call(state) do |state| state.fetch(:value) end
- Output
Sets the value to a given path
@example Maps “A” to { a: { b: { c: “A” } } }
state = Remap::State.call("A") result = Remap::Path::Output.new([:a, :b, :c]).call(state) result.fetch(:value) # => { a: { b: { c: "A" } } }