Sha256: 9d08e33f6235ef8d786b5cb04660ac79af1d17fa344720822adecec15e4d7cb0

Contents?: true

Size: 412 Bytes

Versions: 9

Compression:

Stored size: 412 Bytes

Contents

module DbMemoize
  # The Helpers module contains some helper methods, mostly to not pollute
  # the namespace of memoized objects and classes.
  module Helpers
    extend self

    def find_ids(records_or_ids)
      records_or_ids = Array(records_or_ids)
      return [] if records_or_ids.empty?

      records_or_ids.first.is_a?(ActiveRecord::Base) ? records_or_ids.map(&:id) : records_or_ids
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
db_memoize-0.4.0 lib/db_memoize/helpers.rb
db_memoize-0.3.14 lib/db_memoize/helpers.rb
db_memoize-0.3.13 lib/db_memoize/helpers.rb
db_memoize-0.3.12 lib/db_memoize/helpers.rb
db_memoize-0.3.11 lib/db_memoize/helpers.rb
db_memoize-0.3.10 lib/db_memoize/helpers.rb
db_memoize-0.3.9 lib/db_memoize/helpers.rb
db_memoize-0.3.8 lib/db_memoize/helpers.rb
db_memoize-0.3.7 lib/db_memoize/helpers.rb