Sha256: ccc9fb839f034efbaf7eb7690b099f16c0059823fe2e7d419fd0ad64c164605a

Contents?: true

Size: 563 Bytes

Versions: 3

Compression:

Stored size: 563 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.reject { |k, _| k == :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

3 entries across 3 versions & 1 rubygems

Version Path
loco-rails-6.1.0 lib/loco/permissions_presenter.rb
loco-rails-6.0.0 lib/loco/permissions_presenter.rb
loco-rails-5.0.0 lib/loco/permissions_presenter.rb