lib/scope.rb in expressive-0.0.10 vs lib/scope.rb in expressive-0.0.11
- old
+ new
@@ -119,10 +119,10 @@
define('<') {|a,b| a.to_f < b.to_f }
define('>=') {|a,b| a.to_f >= b.to_f }
define('<=') {|a,b| a.to_f <= b.to_f }
define('and') {|a,b| !!a && !!b }
define('or') {|a,b| !!a || !!b }
- define('sum') { |*args| args.flatten.map(&:to_f).reduce(:+) }
+ define('sum') { |*args| args.flatten.map(&:to_f).reduce(:+) || 0 }
define('if') { |*args| args.compact!; args[0] ? args[1] : args[2] }
end
def to_hash
h = self.retrieve_scope.dup