Module: Foobara::CommandPatternImplementation::Concerns::InputsType::ClassMethods

Defined in:
foobara-0.0.110/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb

Instance Method Summary collapse

Instance Method Details

#add_inputsObject



28
29
30
31
32
33
34
35
36
# File 'foobara-0.0.110/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb', line 28

def add_inputs(...)
  new_type = type_for_declaration(...)
  new_declaration = TypeDeclarations::Attributes.merge(
    inputs_type.declaration_data,
    new_type.declaration_data
  )

  inputs new_declaration
end

#inputsObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'foobara-0.0.110/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb', line 8

def inputs(...)
  old_inputs_type = inputs_type

  old_inputs_type&.possible_errors&.each do |possible_error|
    unregister_possible_error_if_registered(possible_error)
  end

  type = type_for_declaration(...)

  if type.extends?(BuiltinTypes[:model]) && !type.extends?(BuiltinTypes[:entity])
    type = type.element_types
  end

  @inputs_type = type

  register_possible_input_errors

  @inputs_type
end

#inputs_typeObject



38
39
40
41
42
43
44
# File 'foobara-0.0.110/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb', line 38

def inputs_type
  return @inputs_type if defined?(@inputs_type)

  @inputs_type = if superclass < Foobara::Command
                   superclass.inputs_type
                 end
end

#inputs_type_declarationObject



50
51
52
# File 'foobara-0.0.110/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb', line 50

def inputs_type_declaration
  inputs_type.declaration_data
end

#raw_inputs_type_declarationObject



46
47
48
# File 'foobara-0.0.110/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb', line 46

def raw_inputs_type_declaration
  inputs_type.raw_declaration_data
end