Module: Trailblazer::Pro::DSL

Defined in:
lib/trailblazer/pro/session.rb

Class Method Summary collapse

Class Method Details

.trace_operations(operation_hash) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/trailblazer/pro/session.rb', line 60

def trace_operations(operation_hash)
  decisions =
    if operation_hash == :all
      Trailblazer::Operation.extend(Trailblazer::Pro::Operation::Call)

      raise "implement me"
    elsif operation_hash.is_a?(Hash)
      operation_hash.collect do |operation, strategy| # DISCUSS: this can be easily made faster for runtime.
        operation.extend(Trailblazer::Pro::Operation::Call) # only extend selected OPs.

        strategy = Trailblazer::Pro::Trace::Wtf if strategy === true # defaulting.

        ->(activity, *) { activity == operation ? [strategy, {}] : false }
      end
    else
      []
    end

  Trace::Decision.new(decisions)
end