Class: TRMNLP::TransformPipeline
- Inherits:
-
Object
- Object
- TRMNLP::TransformPipeline
- Defined in:
- lib/trmnlp/transform_pipeline.rb
Overview
Pipes assembled merge_variables through src/transform.py,rb,php,js when a serverless runtime is configured. Mirrors the hosted transform behavior: the transform receives the data (including the trmnl namespace) on stdin and its stdout JSON replaces the data. Failure modes surface via #error (rendered in the preview UI), not raised.
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #call(data) ⇒ Object
-
#initialize(config:, paths:, reporter: Reporter.new) ⇒ TransformPipeline
constructor
A new instance of TransformPipeline.
- #reset! ⇒ Object
Constructor Details
#initialize(config:, paths:, reporter: Reporter.new) ⇒ TransformPipeline
Returns a new instance of TransformPipeline.
18 19 20 21 22 |
# File 'lib/trmnlp/transform_pipeline.rb', line 18 def initialize(config:, paths:, reporter: Reporter.new) @config = config @paths = paths @reporter = reporter end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
16 17 18 |
# File 'lib/trmnlp/transform_pipeline.rb', line 16 def error @error end |
Instance Method Details
#call(data) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/trmnlp/transform_pipeline.rb', line 24 def call(data) @error = nil transform_path, inferred_language = paths.transform_file return data unless transform_path && client run(transform_path, inferred_language, data) end |
#reset! ⇒ Object
32 |
# File 'lib/trmnlp/transform_pipeline.rb', line 32 def reset! = @client = nil |