lib/scope.rb in expressive-0.0.11 vs lib/scope.rb in expressive-0.0.12
- old
+ new
@@ -121,9 +121,10 @@
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(:+) || 0 }
define('if') { |*args| args.compact!; args[0] ? args[1] : args[2] }
+ define('round'){|*args| args[0].to_f.round(args[1]) }
end
def to_hash
h = self.retrieve_scope.dup
h.delete_if{|k, v| v.kind_of?(Expressive::Function) || v.kind_of?(Expressive::ExtendedValue)}