Ruy is a lightweight rules evaluator
Fork me on GitHub

Why Ruy

Ruy defines an easy-to-learn language which allows users to declare context-driven conditional expressions. For example, it may be used in determining the number of miles earned by Alice while shopping during Black Friday for a total of $400 via credit card, resulting in Alice being eligible for 1,000 miles.


  • discount_day.rb
gifter =

gifter.set :name, 'Unforgettable Fridays'

gifter.eq :friday, :day_of_week

gifter.outcome 7 do
  greater_than_or_equal 100, :amount

gifter.fallback 0 :friday, amount: 256)
# => 7 :monday, amount: 124)
# => 0