Class: Brute::Turn::Pipeline
- Inherits:
-
Rack::Builder
- Object
- Rack::Builder
- Brute::Turn::Pipeline
- Includes:
- Chainable
- Defined in:
- lib/brute/turn/pipeline.rb
Direct Known Subclasses
Defined Under Namespace
Modules: Chainable Classes: NullSink
Class Method Summary collapse
-
.new_from_string(builder_script, path = "(rackup)", **options) ⇒ Object
Rack's
new_from_stringevaluates the script then returnsto_app— the built callable.
Instance Method Summary collapse
-
#hooks ⇒ Object
The lifecycle-hook registry for this pipeline (see Brute::Hooks).
Methods included from Chainable
Class Method Details
.new_from_string(builder_script, path = "(rackup)", **options) ⇒ Object
Rack's new_from_string evaluates the script then returns to_app —
the built callable. An agent, though, is the builder: you .start it,
and it may be re-used or served through the Rack adapter. So evaluate
the script against a fresh builder and hand back the builder itself.
This also backs parse_file (→ load_file → here), so
AgentPipeline.parse_file("agent.ru").start(prompt) works as documented.
42 43 44 45 46 |
# File 'lib/brute/turn/pipeline.rb', line 42 def self.new_from_string(builder_script, path = "(rackup)", **) builder = new(**) eval(builder_script, ::Rack::BUILDER_TOPLEVEL_BINDING.call(builder), path) # rubocop:disable Security/Eval builder end |