Sha256: 91cccc6617cd4183c5ca157b5600849f3ca9e79e439d21f83da6588408036fdb
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
# Dependencies can be defined on the operation. class level class Trailblazer::Operation # The use of this module is currently not encouraged and it is only here for backward-compatibility. # Instead, please pass dependencies via containers, locals, or macros into the respective steps. # module ClassDependencies def [](field) class_fields[field] end # Store a field on @state, which is provided by {Strategy}. def []=(field, value) @state.update!(:fields) do |fields| fields.merge(field => value) end end def options_for_public_call(options, flow_options) ctx = super context_for_fields(class_fields, [ctx, flow_options]) end private def class_fields @state.get(:fields) end private def context_for_fields(fields, (ctx, flow_options), **) ctx_with_fields = Trailblazer::Context(fields, ctx, flow_options[:context_options]) # TODO: redundant to otions_for_public_call. end def call_with_circuit_interface((ctx, flow_options), **circuit_options) ctx_with_fields = context_for_fields(class_fields, [ctx, flow_options], **circuit_options) super([ctx_with_fields, flow_options], **circuit_options) # FIXME: should we unwrap here? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
trailblazer-operation-0.8.0 | lib/trailblazer/operation/class_dependencies.rb |
trailblazer-operation-0.8.0.beta1 | lib/trailblazer/operation/class_dependencies.rb |