Module: Foobara::CommandPatternImplementation::Concerns::InputsType::ClassMethods
- Defined in:
- foobara-0.6.1/projects/command/src/command_pattern_implementation/concerns/inputs_type.rb
Instance Method Summary collapse
Instance Method Details
#add_inputs ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'projects/command/src/command_pattern_implementation/concerns/inputs_type.rb', line 31 def add_inputs(...) if inputs_type new_type = type_for_declaration(...) new_declaration = TypeDeclarations::Attributes.merge( inputs_type.declaration_data, new_type.declaration_data ) inputs new_declaration else inputs(...) end end |
#inputs ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'projects/command/src/command_pattern_implementation/concerns/inputs_type.rb', line 10 def inputs(...) type = type_for_declaration(...) unless type.extends?(BuiltinTypes[:attributes]) raise BadCommandInputsError, "Expected attributes or something unambiguously convertable to attributes " \ "but got #{type}" end old_inputs_type = inputs_type old_inputs_type&.possible_errors&.each do |possible_error| unregister_possible_error_if_registered(possible_error) end @inputs_type = type register_possible_input_errors @inputs_type end |
#inputs_type ⇒ Object
45 46 47 48 49 50 51 |
# File 'projects/command/src/command_pattern_implementation/concerns/inputs_type.rb', line 45 def inputs_type return @inputs_type if defined?(@inputs_type) @inputs_type = if superclass < Foobara::Command superclass.inputs_type end end |
#inputs_type_declaration ⇒ Object
53 54 55 |
# File 'projects/command/src/command_pattern_implementation/concerns/inputs_type.rb', line 53 def inputs_type_declaration inputs_type.declaration_data end |