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.

comparators.rb 1001B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. require_relative './operation'
  2. module Dentaku
  3. module AST
  4. class Comparator < Operation
  5. def self.precedence
  6. 5
  7. end
  8. def type
  9. :logical
  10. end
  11. end
  12. class LessThan < Comparator
  13. def value(context={})
  14. left.value(context) < right.value(context)
  15. end
  16. end
  17. class LessThanOrEqual < Comparator
  18. def value(context={})
  19. left.value(context) <= right.value(context)
  20. end
  21. end
  22. class GreaterThan < Comparator
  23. def value(context={})
  24. left.value(context) > right.value(context)
  25. end
  26. end
  27. class GreaterThanOrEqual < Comparator
  28. def value(context={})
  29. left.value(context) >= right.value(context)
  30. end
  31. end
  32. class NotEqual < Comparator
  33. def value(context={})
  34. left.value(context) != right.value(context)
  35. end
  36. end
  37. class Equal < Comparator
  38. def value(context={})
  39. left.value(context) == right.value(context)
  40. end
  41. end
  42. end
  43. end