Class: Trailblazer::Activity::DSL::Linear::VariableMapping::DSL::Tuple

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

Overview

Keeps user’s DSL configuration for a particular io-pipe step. Implements the interface for the actual I/O code and is DSL code happening in the normalizer. The actual I/O code expects In and Out objects to generate the two io-pipes.

If a user needs to inject their own private iop step they can create this data structure with desired values here. This is also the reason why a lot of options computation such as :with_outer_ctx happens here and not in the IO code.

Direct Known Subclasses

In, Inject, Out

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(variable_name, add_variables_class, filters_builder, add_variables_class_for_callable = nil, insert_args: nil, **options) ⇒ Tuple

Returns a new instance of Tuple.



101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/trailblazer/activity/dsl/linear/feature/variable_mapping/dsl.rb', line 101

def initialize(variable_name, add_variables_class, filters_builder, add_variables_class_for_callable = nil, insert_args: nil, **options)
  @options =
    {
      variable_name:        variable_name,
      add_variables_class:  add_variables_class,
      filters_builder:      filters_builder,
      insert_args:          insert_args,

      add_variables_class_for_callable: add_variables_class_for_callable,

      **options
    }
end

Class Method Details

.filters_from_options(tuples_to_user_filters) ⇒ Object



119
120
121
# File 'lib/trailblazer/activity/dsl/linear/feature/variable_mapping/dsl.rb', line 119

def self.filters_from_options(tuples_to_user_filters)
  tuples_to_user_filters.flat_map { |tuple, user_filter| tuple.(user_filter) }
end

Instance Method Details

#call(user_filter) ⇒ Filter

Returns Filter instance that keeps name and aggregate_step.

Returns:

  • (Filter)

    Filter instance that keeps name and aggregate_step.



124
125
126
# File 'lib/trailblazer/activity/dsl/linear/feature/variable_mapping/dsl.rb', line 124

def call(user_filter)
  @options[:filters_builder].(user_filter, **to_h)
end

#to_hObject



115
116
117
# File 'lib/trailblazer/activity/dsl/linear/feature/variable_mapping/dsl.rb', line 115

def to_h
  @options
end