Class: Remap::Rule::Wrap

Inherits:
Remap::Rule show all
Defined in:
lib/remap/rule/wrap.rb

Instance Method Summary collapse

Instance Method Details

#call(state) ⇒ State

Wraps the output from #rule in a #type

Examples:

mapps { car: “Volvo” } to { cars: [“Volvo”] }

to :cars do
  wrap(:array) do
    map :car
  end
end

Parameters:

Returns:



25
26
27
# File 'lib/remap/rule/wrap.rb', line 25

def call(state)
  rule.call(state).fmap { Array.wrap(_1) }
end