def conditions_combination step_conditions_labels
conditions_combination_hash = Hash.new
1.upto(step_conditions_labels.size).flat_map do |n|
conditions_combination = “”
step_conditions_labels.permutation(n).map { |condition|
if condition.length == n
conditions_combination += "( "
condition.each do |condition_label|
conditions_combination += condition_label+" && "
end
conditions_combination = conditions_combination.chomp(’ && ')
conditions_combination += " ) || "
end
conditions_combination_hash[n.to_s] = conditions_combination.chomp(’ || ‘).chomp(’ && ')
}
end
cond = false
condition_check = conditions_combination_hash[step_conditions_labels.length.to_s]
if condition_check
cond = true
end
return cond
end
I have created this function
conditions_combination_hash = conditions_combination([‘true’,‘false’,‘true’])
which gives me different combination like this
{“1”=>“( true ) || ( false ) || ( true )”, “2”=>“( true && false ) || ( true && true ) || ( false && true ) || ( false && true ) || ( true && true ) || ( true && false )”, “3”=>“( true && false && true ) || ( true && true && false ) || ( false && true && true ) || ( false && true && true ) || ( true && true && false ) || ( true && false && true )”}
Issue is now I am not able use this combination to check whether it satisfies the condition as it is consider as string class.