Class: Trailblazer::Pro::Trace::Decision

Inherits:
Struct
  • Object
show all
Defined in:
lib/trailblazer/pro/trace/decision.rb

Overview

Used in Activity.call monkey-patch.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#guardsObject

Returns the value of attribute guards

Returns:

  • (Object)

    the current value of guards



4
5
6
# File 'lib/trailblazer/pro/trace/decision.rb', line 4

def guards
  @guards
end

Instance Method Details

#call(activity, ctx) ⇒ Object

DISCUSS: signature not stable, yet.



5
6
7
8
9
10
11
# File 'lib/trailblazer/pro/trace/decision.rb', line 5

def call(activity, ctx) # DISCUSS: signature not stable, yet.
  guards.each do |guard|
    result = guard.(activity, ctx) and return result # DISCUSS: {ctx.to_hash}?
  end

  false
end