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


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

def build(relation, options = {})
  if options.key?(:input) || !relation.schema?
    super
  else
    default_input = options.fetch(:input, input)

    input_handler =
      if default_input != Hash
        -> tuple { relation.input_schema[input[tuple]] }
      else
        relation.input_schema
      end

    super(relation, options.merge(input: input_handler))
  end
end