Sha256: b158e4cf68009f28707d7b76b01a2d66ec6eade938f5fd76b8b39911e42d0263

Contents?: true

Size: 604 Bytes

Versions: 4

Compression:

Stored size: 604 Bytes

Contents

# frozen_string_literal: true

module Lite
  module Query
    class Base

      attr_accessor :relation
      attr_reader :args

      class << self

        def call(relation = nil, args = {})
          klass = new(relation, args)
          klass.call
        end

      end

      def initialize(relation = nil, args = {})
        @relation = relation || default_relation
        @args = args
      end

      def call
        raise Lite::Query::NotImplementedError unless defined?(execute)

        execute
      end

      private

      def default_relation
        nil
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lite-query-1.1.2 lib/lite/query/base.rb
lite-query-1.1.1 lib/lite/query/base.rb
lite-query-1.1.0 lib/lite/query/base.rb
lite-query-1.0.8 lib/lite/query/base.rb