Module: Micro::Cases::Utils

Defined in:
lib/micro/cases/utils.rb

Class Method Summary collapse

Class Method Details

.map_use_cases(args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/micro/cases/utils.rb', line 7

def self.map_use_cases(args)
  collection = args.is_a?(Array) && args.size == 1 ? args[0] : args

  Array(collection).each_with_object([]) do |arg, memo|
    if arg.is_a?(Flow)
      arg.use_cases.each { |use_case| memo << use_case }
    else
      memo << arg
    end
  end
end