Sha256: 96a956216cb3f12f15c3a7ad83dfb57c9363da0403c13990bfb0da482a0d6473

Contents?: true

Size: 910 Bytes

Versions: 2

Compression:

Stored size: 910 Bytes

Contents

# frozen_string_literal: true

module Praxis
  module Mapper
    module Resources
      module QueryMethods
        extend ::ActiveSupport::Concern

        # Includes some limited, but handy query methods so we can transparently
        # use them from the resource layer, and get wrapped resources from it
        module ClassMethods
          def including(args)
            QueryProxy.new(klass: self).including(args)
          end

          def all(args = {})
            QueryProxy.new(klass: self).all(args)
          end

          def get(args)
            QueryProxy.new(klass: self).get(args)
          end

          def get!(args)
            QueryProxy.new(klass: self).get!(args)
          end

          def first
            QueryProxy.new(klass: self).first
          end

          def last
            QueryProxy.new(klass: self).last
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
praxis-2.0.pre.23 lib/praxis/mapper/resources/query_methods.rb
praxis-2.0.pre.22 lib/praxis/mapper/resources/query_methods.rb