lib/scope.rb in expressive-0.0.6 vs lib/scope.rb in expressive-0.0.7
- old
+ new
@@ -85,9 +85,19 @@
syntax('get') do |scope, cells|
perform_webhook(:get, scope, cells)
end
+ syntax('date') do |scope, cells|
+ if cells.empty?
+ Date.today.to_time.utc
+ else
+ date = cells.first.text_value.gsub(/[\)\(]/, '')
+ values = date.split('/').map(&:to_i).reverse
+ Date.new(values[0], values[1], values[2]).to_time.utc
+ end
+ end
+
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('/') {|a,b| a.to_f / b.to_f }
define('=') {|a,b| a == b }