lib/dentaku.rb in dentaku-3.0.0 vs lib/dentaku.rb in dentaku-3.1.0

- old
+ new

@@ -3,15 +3,20 @@ require "dentaku/version" module Dentaku @enable_ast_caching = false @enable_dependency_order_caching = false + @aliases = {} - def self.evaluate(expression, data={}) + def self.evaluate(expression, data = {}) calculator.evaluate(expression, data) end + def self.evaluate!(expression, data = {}) + calculator.evaluate!(expression, data) + end + def self.enable_caching! enable_ast_cache! enable_dependency_order_cache! end @@ -29,15 +34,23 @@ def self.cache_dependency_order? @enable_dependency_order_caching end + def self.aliases + @aliases + end + + def self.aliases=(hash) + @aliases = hash + end + private def self.calculator @calculator ||= Dentaku::Calculator.new end end -def Dentaku(expression, data={}) +def Dentaku(expression, data = {}) Dentaku.evaluate(expression, data) end