Skip to content

Commit d999d72

Browse files
fixed audience segment fetch logic (#320)
Co-authored-by: Mirza Sohail Hussain <[email protected]>
1 parent 841e7e2 commit d999d72

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/optimizely/audience.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ def get_segments(conditions)
112112
# Returns array of segment names.
113113
segments = []
114114

115-
conditions.each do |condition|
116-
case condition
117-
when Array
115+
case conditions
116+
when Hash
117+
segments.push(conditions['value']) if conditions.fetch('match', nil) == 'qualified'
118+
when Array
119+
conditions.each do |condition|
118120
segments.concat @parse_segments.call(condition)
119-
when Hash
120-
segments.push(condition['value']) if condition.fetch('match', nil) == 'qualified'
121121
end
122122
end
123123

0 commit comments

Comments
 (0)