Sha256: ee7d797a44772612190f7b4e11faed2e8a56367f204179c35a37a5f922cfa2c2
Contents?: true
Size: 421 Bytes
Versions: 4
Compression:
Stored size: 421 Bytes
Contents
# frozen_string_literal: true module ActsAsFavoritor module FavoritorLib def build_result_for_scopes(scopes) return if scopes.empty? scopes = sanitized_scopes(scopes) result = scopes.map { |scope| [scope, yield(scope)] }.to_h return result[scopes.first] if scopes.size == 1 result end private def sanitized_scopes(scopes) scopes.map(&:to_sym) end end end
Version data entries
4 entries across 4 versions & 1 rubygems