Skip to content

Commit 6695384

Browse files
committed
allow arbitrary value in conditions array (of arrays) to include conditionless calculation, comes back as 'default'
1 parent 5d052f6 commit 6695384

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/esdb.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ def initialize(stats)
1111
values = 'avg'
1212
elsif value.is_a?(Hash)
1313
values = value.collect{|calc, conds|
14-
if conds[0].is_a?(Array)
15-
conds.collect{|_conds| "#{calc}:[#{_conds.join(',')}]"}.join(',')
14+
if conds.collect(&:class).include?(Array)
15+
conds.collect{|_conds| "#{calc}#{":[#{_conds.join(',')}]" if _conds.is_a?(Array)}"}.join(',')
1616
else
1717
"#{calc}:[#{conds.join(',')}]"
1818
end

0 commit comments

Comments
 (0)