Sha256: c2fd631a71f6085402a88319178bcfba02276087178036c18a757c6c389002b3
Contents?: true
Size: 859 Bytes
Versions: 10
Compression:
Stored size: 859 Bytes
Contents
# frozen_string_literal: true module ROM module Commands class Lazy # Lazy command wrapper for create commands # # @api public class Create < Lazy # Execute a command # # @see Command::Create#call # # @return [Hash,Array<Hash>] # # @api public def call(*args) first = args.first last = args.last size = args.size if size > 1 && last.is_a?(Array) last.map.with_index do |parent, index| children = evaluator.call(first, index) command_proc[command, parent, children].call(children, parent) end.reduce(:concat) else input = evaluator.call(first) command.call(input, *args[1..size - 1]) end end end end end end
Version data entries
10 entries across 10 versions & 2 rubygems