class Remap::Rule::Map::Optional
@api private
Public Instance Methods
call(state)
click to toggle source
Represents an optional mapping rule When the mapping fails, the value is ignored
@example Map
[:name] to [:nickname]
map = Map::Optional.call({ backtrace: caller, path: { input: [:name], output: [:nickname] } }) state = Remap::State.call({ name: "John" }) output = map.call(state) do |failure| raise failure.exception(caller) end output.fetch(:value) # => { nickname: "John" }
@see Map#call
Calls superclass method
# File lib/remap/rule/map/optional.rb, line 33 def call(state) catch_ignored(state) { super(_1) } end