module Rulz::Conditions::Comparison
Public Class Methods
included(base)
click to toggle source
# File lib/rulz/conditions/comparison.rb, line 29 def self.included(base) base.class_eval do define_rulz do condition "greater than" do |other| it > other end condition "less than" do |other| it < other end condition "equal to" do |other| it == other end condition "not equal to" do |other| opposite_of "equal to", other end end end end
load_conditions(reciever, attr)
click to toggle source
# File lib/rulz/conditions/comparison.rb, line 5 def self.load_conditions(reciever, attr) reciever.class_eval do define_rulz do attribute attr do condition "greater than" do |other| send(attr) > other end condition "less than" do |other| send(attr) < other end condition "equal to" do |other| send(attr) == other end condition "not equal to" do |other| opposite_of "equal to", other end end end end end