Sha256: 03bac2d93015bed91cdc8a29ac9b4dc9b2cd1522a8958f951d5084b16a80cd3f
Contents?: true
Size: 1.24 KB
Versions: 2
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true 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 # @private module ClassMethods %i[where consistent all first last delete_all destroy_all each record_limit scan_limit batch start scan_index_forward find_by_pages project pluck].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, &blk| # Don't use keywork arguments delegating (with **kw). It works in # different way in different Ruby versions: <= 2.6, 2.7, 3.0 and in some # future 3.x versions. Providing that there are no downstream methods # with keyword arguments in Chain. # # https://eregon.me/blog/2019/11/10/the-delegation-challenge-of-ruby27.html chain = Dynamoid::Criteria::Chain.new(self) if args chain.send(meth, *args, &blk) else chain.send(meth, &blk) end end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
dynamoid-3.7.1 | lib/dynamoid/criteria.rb |
dynamoid-3.7.0 | lib/dynamoid/criteria.rb |