Module: ROM::Plugins::Command::Schema::ClassInterface Private

Defined in:
lib/rom/plugins/command/schema.rb

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.

Instance Method Summary collapse

Instance Method Details

#build(relation, **options) ⇒ Command

Build a command and set it input to relation's input_schema

Returns:

See Also:

  • Command.build

24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rom/plugins/command/schema.rb', line 24

def build(relation, **options)
  if relation.schema? && !options.key?(:input)
    relation_input = relation.input_schema
    command_input = input

    composed_input =
      if command_input.equal?(ROM::Command.input)
        relation_input
      else
        -> tuple { relation_input[command_input[tuple]] }
      end

    super(relation, **options, input: composed_input)
  else
    super
  end
end