Sha256: 92d09eb1893c7be38921895e981b7c5e7de1660b4acb82d243e1e10b11b46042

Contents?: true

Size: 359 Bytes

Versions: 3

Compression:

Stored size: 359 Bytes

Contents

# frozen_string_literal: true

module ActsAsFavoritor
  module FavoritorLib
    def build_result_for_scopes(scopes, &block)
      return yield(scopes) unless scopes.is_a?(Array)
      return if scopes.empty?

      sanitized_scopes(scopes).index_with(&block)
    end

    private

    def sanitized_scopes(scopes)
      scopes.map(&:to_sym)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
acts_as_favoritor-6.0.2 lib/acts_as_favoritor/favoritor_lib.rb
acts_as_favoritor-6.0.1 lib/acts_as_favoritor/favoritor_lib.rb
acts_as_favoritor-6.0.0 lib/acts_as_favoritor/favoritor_lib.rb