Class: Foobara::CommandConnectors::Http::SetInputToProcResult
- Inherits:
-
RequestMutator
- Object
- Value::Processor
- Value::Mutator
- RequestMutator
- Foobara::CommandConnectors::Http::SetInputToProcResult
- Defined in:
- foobara-http-command-connector-0.0.26/src/http/request_mutators/set_input_to_proc_result.rb
Overview
TODO: We don’t really want to mutate the request. We just need access to the authenticated user. consider changing inputs transformer to have access to the command/request somehow
Direct Known Subclasses
Class Attribute Summary collapse
-
.attribute_name ⇒ Object
Returns the value of attribute attribute_name.
-
.input_value_proc ⇒ Object
Returns the value of attribute input_value_proc.
Instance Attribute Summary collapse
Attributes inherited from Value::Processor
#created_in_namespace, #declaration_data, #parent_declaration_data
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from RequestMutator
Methods inherited from Value::Mutator
error_classes, foobara_manifest, #process_value
Methods inherited from Value::Processor
#always_applicable?, #build_error, default_declaration_data, #dup_processor, error_class, error_classes, #error_context, #error_message, #error_path, foobara_manifest, #foobara_manifest, #initialize, #inspect, instance, #method_missing, #name, new_with_agnostic_args, #possible_errors, #priority, #process_outcome, #process_outcome!, #process_value, #process_value!, processor_name, requires_declaration_data?, requires_parent_declaration_data?, #respond_to_missing?, #runner, symbol
Methods included from IsManifestable
#foobara_domain, #foobara_manifest, #foobara_organization, #scoped_clear_caches
Methods included from Foobara::Concern
foobara_class_methods_module_for, foobara_concern?, included
Constructor Details
This class inherits a constructor from Foobara::Value::Processor
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Foobara::Value::Processor
Class Attribute Details
.attribute_name ⇒ Object
Returns the value of attribute attribute_name.
8 9 10 |
# File 'foobara-http-command-connector-0.0.26/src/http/request_mutators/set_input_to_proc_result.rb', line 8 def attribute_name @attribute_name end |
.input_value_proc ⇒ Object
Returns the value of attribute input_value_proc.
8 9 10 |
# File 'foobara-http-command-connector-0.0.26/src/http/request_mutators/set_input_to_proc_result.rb', line 8 def input_value_proc @input_value_proc end |
Instance Attribute Details
#attribute_name ⇒ Object
35 36 37 |
# File 'foobara-http-command-connector-0.0.26/src/http/request_mutators/set_input_to_proc_result.rb', line 35 def attribute_name @attribute_name ||= self.class.attribute_name end |
#input_value_proc ⇒ Object
39 40 41 |
# File 'foobara-http-command-connector-0.0.26/src/http/request_mutators/set_input_to_proc_result.rb', line 39 def input_value_proc @input_value_proc ||= self.class.input_value_proc end |
Class Method Details
.for(attribute_name, &input_value_proc) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'foobara-http-command-connector-0.0.26/src/http/request_mutators/set_input_to_proc_result.rb', line 10 def for(attribute_name, &input_value_proc) subclass = Class.new(self) subclass.attribute_name = attribute_name subclass.input_value_proc = input_value_proc subclass end |
Instance Method Details
#applicable?(_request) ⇒ Boolean
27 28 29 |
# File 'foobara-http-command-connector-0.0.26/src/http/request_mutators/set_input_to_proc_result.rb', line 27 def applicable?(_request) true end |
#inputs_type_from(inputs_type) ⇒ Object
22 23 24 25 |
# File 'foobara-http-command-connector-0.0.26/src/http/request_mutators/set_input_to_proc_result.rb', line 22 def inputs_type_from(inputs_type) new_declaration = TypeDeclarations::Attributes.reject(inputs_type.declaration_data, attribute_name) Domain.current.(new_declaration) end |
#mutate(request) ⇒ Object
31 32 33 |
# File 'foobara-http-command-connector-0.0.26/src/http/request_mutators/set_input_to_proc_result.rb', line 31 def mutate(request) request.inputs[attribute_name] = request.instance_exec(&input_value_proc) end |