Sha256: a79eadcc50f10114ceeed8007e45ba014f8552fdbf95bb227f924ae1e33e2241

Contents?: true

Size: 773 Bytes

Versions: 10

Compression:

Stored size: 773 Bytes

Contents

# encoding: utf-8
require 'dynamoid/criteria/chain'

module Dynamoid

  # Allows classes to be queried by where, all, first, and each and return criteria chains.
  module Criteria
    extend ActiveSupport::Concern
    
    module ClassMethods
      
      [:where, :all, :first, :each, :limit, :start, :scan_index_forward].each do |meth|
        # Return a criteria chain in response to a method that will begin or end a chain. For more information, 
        # see Dynamoid::Criteria::Chain.
        #
        # @since 0.2.0
        define_method(meth) do |*args|
          chain = Dynamoid::Criteria::Chain.new(self)
          if args
            chain.send(meth, *args)
          else
            chain.send(meth)
          end
        end
      end
    end
  end
  
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
dynamoid-moda-0.7.2 lib/dynamoid/criteria.rb
dynamoid-moda-0.7.1 lib/dynamoid/criteria.rb
dynamoid-0.7.1 lib/dynamoid/criteria.rb
dynamoid-0.7.0 lib/dynamoid/criteria.rb
dynamoid-0.6.1 lib/dynamoid/criteria.rb
dynamoid-0.6.0 lib/dynamoid/criteria.rb
adept_dynamoid-0.6.0 lib/dynamoid/criteria.rb
adept_dynamoid-0.5.0.8 lib/dynamoid/criteria.rb
adept_dynamoid-0.5.0.7 lib/dynamoid/criteria.rb
adept_dynamoid-0.5.0.6 lib/dynamoid/criteria.rb