Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Class Dependencies (possible implementation change) #60

Open
apotonick opened this issue Nov 5, 2021 · 0 comments
Open

Class Dependencies (possible implementation change) #60

apotonick opened this issue Nov 5, 2021 · 0 comments

Comments

@apotonick
Copy link
Member

Class Dependencies

  • Class dependencies allow setting (temporary?) ctx variables for an operation.
  • Currently, those variables stay in the result ctx and hence bleed through to the outer operation when nested. Maybe an expose: true could configure this?
class Index < Trailblazer::Operation
    extend ClassDependencies

    self["model.class"] = Module

    step ->(ctx, **) { ctx["a"] = ctx["model.class"] }
  end

Implementation

  • Currently, in #public_call and #call_with_circuit_interface we create a new Context where those variables are set.
  • Ideally, we should use :inject and/or :input instead in the outer operation and set the inner class variables with an injection. This would also reduce run-time logic. E.g. the Subprocess() macro could take care of this.
  • For the topmost operation, the endpoint could be doing this, instead of clumsily hacking this feature.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant