Sha256: bfc09b4c5bc3d7d93dea8eeed69abcbbdd36c45117592f1025f306e992edc853

Contents?: true

Size: 571 Bytes

Versions: 1

Compression:

Stored size: 571 Bytes

Contents

module Predicator
  module Predicates
    class Between
      attr_reader :value, :left, :right

      def initialize value, left, right
        @value, @left, @right = value, left, right
      end

      def satisfied? context=Predicator::Context.new
        context.value_for(value) >= context.value_for(left) &&
          context.value_for(value) <= context.value_for(right)
      end

      def == other
        other.kind_of?(self.class) &&
          other.value == value &&
          other.left == left &&
          other.right == right
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
predicator-0.3.0 lib/predicator/predicates/between.rb