Module: Loco::PermissionsPresenter

Defined in:
lib/loco/permissions_presenter.rb

Class Method Summary collapse

Class Method Details

.indexed(loco_permissions, opts = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
# File 'lib/loco/permissions_presenter.rb', line 7

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

.signed_in(loco_permissions, opts = {}) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/loco/permissions_presenter.rb', line 18

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