Sha256: 2ac5ba354c7d466bb3c2aa46406803639903e2f5e23268229325b5076c6ee71c

Contents?: true

Size: 1.31 KB

Versions: 5

Compression:

Stored size: 1.31 KB

Contents

module AgnosticBackend
  module Queryable
    module Criteria
      class Binary < Criterion
        attr_reader :attribute, :value

        def initialize(attribute:, value:, context: nil)
          @attribute, @value = attribute, value
          super([attribute, value], context)
        end
      end

      class Relational < Binary

        def initialize(attribute:, value:, context: nil)
          attribute = attribute_component(attribute: attribute, context: context)
          value = value_component(value: value, context: context, type: attribute.type)
          super(attribute: attribute, value: value, context: context)
        end
      end

      class Equal < Relational;
      end

      class NotEqual < Relational;
      end

      class Greater < Relational;
      end

      class Less < Relational;
      end

      class GreaterEqual < Relational;
      end

      class LessEqual < Relational;
      end

      class Contains < Relational;
      end

      class Starts < Relational;
      end

      class FreeText < Relational;
      end

      class Fuzzy < Relational
        attr_reader :fuzziness

        def initialize(attribute:, value:, context: nil, fuzziness: 1)
          @fuzziness = fuzziness
          super(attribute: attribute, value: value, context: context)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
agnostic_backend-1.0.4 lib/agnostic_backend/queryable/criteria/binary.rb
agnostic_backend-1.0.3 lib/agnostic_backend/queryable/criteria/binary.rb
agnostic_backend-1.0.2 lib/agnostic_backend/queryable/criteria/binary.rb
agnostic_backend-1.0.1 lib/agnostic_backend/queryable/criteria/binary.rb
agnostic_backend-1.0.0 lib/agnostic_backend/queryable/criteria/binary.rb