class DatashiftJourney::StateMachines::BranchSequenceMap

Map a Sequence to its ID, created in form

branch_sequence :other_sequence, [:other_business]

    BranchSequenceMap[:branch_sequence] => Sequence([:other_business])

Public Instance Methods

add_branch(id, sequence) click to toggle source
# File lib/datashift_journey/state_machines/branch_sequence_map.rb, line 22
def add_branch(id, sequence)
  # puts "DEBUG: ADDING TO SEQ [#{id}] BRANCH #{sequence.inspect}"
  self[id] = sequence
end
add_or_concat(id, list) click to toggle source

Create a new Sequence if ID not yet in Map, otherwise add the state list to the existing Sequence

# File lib/datashift_journey/state_machines/branch_sequence_map.rb, line 18
def add_or_concat(id, list)
  key?(id) ? self[id].add_states(list) : add_branch(id, Sequence.new(list.flatten, id: id))
end
branches_for(sequence) click to toggle source

Find the matching branch sequences for a parent Split (first state)

# File lib/datashift_journey/state_machines/branch_sequence_map.rb, line 28
def branches_for(sequence)
  values.find_all { |branch| (branch.entry_state && branch.entry_state == sequence.split_entry_state) }
end