Module: ROM::Commands::Graph::ClassInterface Private
- Included in:
- ROM::Commands::Graph
- Defined in:
- core/lib/rom/commands/graph/class_interface.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Class methods for command Graph
Instance Method Summary collapse
-
#build(registry, options, path = EMPTY_ARRAY) ⇒ Graph
private
Build a command graph recursively.
- #build_command(registry, spec, other, path) ⇒ Object private
Instance Method Details
#build(registry, options, path = EMPTY_ARRAY) ⇒ Graph
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build a command graph recursively
This is used by Container#command
when array with options is passed in
23 24 25 |
# File 'core/lib/rom/commands/graph/class_interface.rb', line 23 def build(registry, , path = EMPTY_ARRAY) .reduce { |spec, other| build_command(registry, spec, other, path) } end |
#build_command(registry, spec, other, path) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'core/lib/rom/commands/graph/class_interface.rb', line 28 def build_command(registry, spec, other, path) cmd_opts, nodes = other key, relation = if spec.is_a?(Hash) spec.to_a.first else [spec, spec] end name, opts = if cmd_opts.is_a?(Hash) cmd_opts.to_a.first else [cmd_opts] end command = registry[relation][name] tuple_path = Array[*path] << key input_proc = InputEvaluator.build(tuple_path, nodes) command = command.curry(input_proc, opts) if nodes if nodes.all? { |node| node.is_a?(Array) } command.combine(*nodes.map { |node| build(registry, node, tuple_path) }) else command.combine(build(registry, nodes, tuple_path)) end else command end end |