Sha256: c7c5b608a8b3df72be7eebb0ddfc15fd30f1ea076c7a5866d716bb8775949096

Contents?: true

Size: 548 Bytes

Versions: 2

Compression:

Stored size: 548 Bytes

Contents

# frozen_string_literal: true

module Loco
  module PermissionsPresenter
    module_function

    def indexed(loco_permissions, opts = {})
      h = signed_in(loco_permissions).index_by do |o|
        o.class.name.downcase.to_sym
      end
      if opts[:except] == :uuid
        h.except(:string)
      else
        h
      end
    end

    def signed_in(loco_permissions, opts = {})
      arr = loco_permissions.compact
      if opts[:except] == :uuid
        arr.reject { |e| e.is_a?(String) }
      else
        arr
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
loco-rails-7.0.0.pre lib/loco/permissions_presenter.rb
loco-rails-6.2.0 lib/loco/permissions_presenter.rb