Sha256: a1d29cc49d710250d179b4d91059c8f0abbfbadd418b834864783de76e09adb4

Contents?: true

Size: 866 Bytes

Versions: 5

Compression:

Stored size: 866 Bytes

Contents

module AgnosticBackend
  module Queryable
    module Cloudsearch
      class Query < AgnosticBackend::Queryable::Query

        def initialize(base, **options)
          super
          case options[:parser]
          when :simple
            @executor = Executor.new(self, SimpleVisitor.new, filter_visitor: Visitor.new)
          when :structured
            @executor = Executor.new(self, Visitor.new, filter_visitor: Visitor.new)
          else
            @executor = Executor.new(self, Visitor.new, filter_visitor: Visitor.new)
          end
        end

        def execute
          @executor.execute if valid?
        end

        def execute!
          if valid?
            @executor.execute
          else
            raise StandardError, errors
          end
        end

        def to_s
          @executor.to_s
        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/cloudsearch/query.rb
agnostic_backend-1.0.3 lib/agnostic_backend/queryable/cloudsearch/query.rb
agnostic_backend-1.0.2 lib/agnostic_backend/queryable/cloudsearch/query.rb
agnostic_backend-1.0.1 lib/agnostic_backend/queryable/cloudsearch/query.rb
agnostic_backend-1.0.0 lib/agnostic_backend/queryable/cloudsearch/query.rb