Class: ROM::Commands::Lazy::Create
- Inherits:
-
ROM::Commands::Lazy
- Object
- ROM::Commands::Lazy
- ROM::Commands::Lazy::Create
- Defined in:
- core/lib/rom/commands/lazy/create.rb
Overview
Lazy command wrapper for create commands
Instance Method Summary collapse
-
#call(*args) ⇒ Hash+
Execute a command.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class ROM::Commands::Lazy
Instance Method Details
#call(*args) ⇒ Hash+
Execute a command
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'core/lib/rom/commands/lazy/create.rb', line 17 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 |