Sha256: c2788044bc0a8816a98fb2ecb9af5b8356bfbef6039962837630215dac3694eb

Contents?: true

Size: 444 Bytes

Versions: 5

Compression:

Stored size: 444 Bytes

Contents

require 'active_support/concern'
require 'active_support/core_ext/module/delegation'

module ActiveHouse
  module Querying
    extend ActiveSupport::Concern

    included do
      class_attribute :_query_class, instance_accessor: false
      self._query_class = ActiveHouse::Query
    end

    class_methods do
      delegate :to_a, :select, :where, :group_by, to: :all

      def all
        _query_class.new(self)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_house-0.1.4 lib/active_house/querying.rb
active_house-0.1.3 lib/active_house/querying.rb
active_house-0.1.2 lib/active_house/querying.rb
active_house-0.1.1 lib/active_house/querying.rb
active_house-0.1.0 lib/active_house/querying.rb