Sha256: fd0171b2af6e054bd85cf32b88cce225aa6ad22cb24b6978e18911f984e09b4e

Contents?: true

Size: 739 Bytes

Versions: 4

Compression:

Stored size: 739 Bytes

Contents

module Casino
  class Intersection
    module Match
      class Greater < Equivalence

        def eligible?
          %w($gt $gte).include? key
        end

        def evaluate
          greater_than? ? greater_than! : greater_than_or_equal!
        end

        private

        def greater_than?
          key == '$gt'
        end

        def greater_than!
          evolved_value > evolved_field
        end

        def greater_than_or_equal!
          evolved_value >= evolved_field
        end

        def evolved_value
          evolve value
        end

        def evolved_field
          evolve field
        end

        def evolve(instance)
          instance.class.evolve(instance)
        end

      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoid-casino-0.0.4 lib/casino/intersection/match/greater.rb
mongoid-casino-0.0.3 lib/casino/intersection/match/greater.rb
mongoid-casino-0.0.2 lib/casino/intersection/match/greater.rb
mongoid-casino-0.0.1 lib/casino/intersection/match/greater.rb