Class: AppBridge::FileProcessor
- Inherits:
-
Object
- Object
- AppBridge::FileProcessor
- Defined in:
- lib/app_bridge/file_processor.rb
Overview
Processes file data from WASM component responses.
Uses the output schema to find fields with format: "file-output" and replaces the file data (base64, content_type, filename) with blob IDs via the configured file_uploader.
The WASM component should use file.read to normalize any input format (URL, data URI, raw base64) into a consistent hash structure before output.
Constant Summary collapse
- FILE_OUTPUT_FORMAT =
"file-output"
Class Method Summary collapse
-
.call(data, schema) ⇒ Hash
Process file data in a response hash.
Instance Method Summary collapse
-
#call ⇒ Hash
Processes the data, uploading files and replacing file data with IDs.
-
#initialize(data, schema) ⇒ FileProcessor
constructor
A new instance of FileProcessor.
Constructor Details
#initialize(data, schema) ⇒ FileProcessor
Returns a new instance of FileProcessor.
28 29 30 31 |
# File 'lib/app_bridge/file_processor.rb', line 28 def initialize(data, schema) @data = deep_dup(data) @schema = schema end |
Class Method Details
.call(data, schema) ⇒ Hash
Process file data in a response hash.
22 23 24 |
# File 'lib/app_bridge/file_processor.rb', line 22 def self.call(data, schema) new(data, schema).call end |
Instance Method Details
#call ⇒ Hash
Processes the data, uploading files and replacing file data with IDs.
36 37 38 39 |
# File 'lib/app_bridge/file_processor.rb', line 36 def call process_node(@data, @schema) @data end |