Sha256: aeaa3eebaed92c91cc9b53a2650eb41d5d3b0c76cb44a49261eace2f6124bd92

Contents?: true

Size: 915 Bytes

Versions: 1

Compression:

Stored size: 915 Bytes

Contents

module Rulz
  module Conditions
    module Number
      def self.load_conditions(reciever, attr)
        reciever.class_eval do
          define_rulz do
            attribute attr do
              condition "is positive" do
                send(attr) > 0
              end
              condition "is negative" do |other|
                send(attr) < 0
              end
              condition "is zero" do |other|
                send(attr) == 0
              end
            end
          end
        end
      end
      
      
      def self.included(base)
        base.class_eval do
          define_rulz do
            condition "is positive" do
              it > 0
            end
            condition "is negative" do |other|
              it < 0
            end
            condition "is zero" do |other|
              it == 0
            end
          end
        end
      end
      
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rulz-1.0.4 lib/rulz/conditions/number.rb