Class: Trailblazer::Activity::DSL::Linear::VariableMapping::Output::Unscoped

Inherits:
Object
  • Object
show all
Defined in:
lib/trailblazer/activity/dsl/linear/variable_mapping.rb

Overview

Merge the resulting @filter@filter.() hash back into the original ctx. DISCUSS: do we need the original_ctx as a filter argument?

Direct Known Subclasses

WithOuterContext

Defined Under Namespace

Classes: WithOuterContext

Instance Method Summary collapse

Constructor Details

#initialize(filter) ⇒ Unscoped

Returns a new instance of Unscoped.



212
213
214
# File 'lib/trailblazer/activity/dsl/linear/variable_mapping.rb', line 212

def initialize(filter)
  @filter = filter
end

Instance Method Details

#call(new_ctx, original_ctx, flow_options, **circuit_options) ⇒ Object

The returned hash from @filter is merged with the original ctx.



217
218
219
220
221
# File 'lib/trailblazer/activity/dsl/linear/variable_mapping.rb', line 217

def call(new_ctx, (original_ctx, flow_options), **circuit_options)
  original_ctx.merge(
    call_filter(new_ctx, [original_ctx, flow_options], **circuit_options)
  )
end

#call_filter(new_ctx, _original_ctx, _flow_options, **circuit_options) ⇒ Object



223
224
225
226
# File 'lib/trailblazer/activity/dsl/linear/variable_mapping.rb', line 223

def call_filter(new_ctx, (_original_ctx, _flow_options), **circuit_options)
  # Pass {inner_ctx, **inner_ctx}
  @filter.(new_ctx, keyword_arguments: new_ctx.to_hash, **circuit_options)
end