Sha256: 94931ebb9e4a3e7187937d74af632c0f67a84e50629839c951f9d3388678e207
Contents?: true
Size: 650 Bytes
Versions: 7
Compression:
Stored size: 650 Bytes
Contents
module Tako module ActiveRecordExt module ShardedMethods def sharded_methods(*method_names) method_names.each do |method_name| define_method(:"#{method_name}_with_tako") do |*params, &block| if current_shard ::Tako.shard(current_shard) { send(:"#{method_name}_without_tako",*params, &block) } else send(:"#{method_name}_without_tako",*params, &block) end end send(:alias_method, :"#{method_name}_without_tako", method_name) send(:alias_method, method_name, :"#{method_name}_with_tako") end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems