Module: Foobara::CommandPatternImplementation::Concerns::ModelInputsType::ClassMethods

Defined in:
foobara-0.6.1/projects/model_plumbing/src/extensions/command_pattern_implementation/concerns/model_inputs_type.rb

Instance Method Summary collapse

Instance Method Details

#inputs(*args, **opts) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'projects/model_plumbing/src/extensions/command_pattern_implementation/concerns/model_inputs_type.rb', line 8

def inputs(*args, **opts, &)
  if args.size == 1 && opts.empty?
    type = args.first

    if type.is_a?(::Class) && (type == Model || type < Model)
      type = type.model_type
    end

    unless skip_model_to_attributes_conversion?(type)
      if type.extends?(BuiltinTypes[:model])
        return super(type.element_types)
      end
    end
  end

  super
end