Fuel plugin to deploy Sensu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

dentaku.rb 801B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. require "bigdecimal"
  2. require "dentaku/calculator"
  3. require "dentaku/version"
  4. module Dentaku
  5. @enable_ast_caching = false
  6. @enable_dependency_order_caching = false
  7. def self.evaluate(expression, data={})
  8. calculator.evaluate(expression, data)
  9. end
  10. def self.enable_caching!
  11. enable_ast_cache!
  12. enable_dependency_order_cache!
  13. end
  14. def self.enable_ast_cache!
  15. @enable_ast_caching = true
  16. end
  17. def self.cache_ast?
  18. @enable_ast_caching
  19. end
  20. def self.enable_dependency_order_cache!
  21. @enable_dependency_order_caching = true
  22. end
  23. def self.cache_dependency_order?
  24. @enable_dependency_order_caching
  25. end
  26. private
  27. def self.calculator
  28. @calculator ||= Dentaku::Calculator.new
  29. end
  30. end
  31. def Dentaku(expression, data={})
  32. Dentaku.evaluate(expression, data)
  33. end