lib/scope.rb in expressive-0.0.14 vs lib/scope.rb in expressive-0.0.15

- old
+ new

@@ -126,9 +126,12 @@ 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]) } + define('$days_ago'){|*args| Time.now - args[0].to_i * 86400 } + define('$hours_ago'){|*args| Time.now - args[0].to_i * 3600 } + define('$minutes_ago'){|*args| Time.now - args[0].to_i * 60 } end def to_hash h = self.retrieve_scope.dup h.delete_if{|k, v| v.kind_of?(Expressive::Function) || v.kind_of?(Expressive::ExtendedValue)}