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)
    schema = relation.input_schema
    input = config.input

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

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