Class: Renalware::System::UsersAwaitingApprovalComponent

Inherits:
ApplicationComponent
  • Object
show all
Defined in:
app/components/renalware/system/users_awaiting_approval_component.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#policy, #renalware

Constructor Details

#initialize(current_user:) ⇒ UsersAwaitingApprovalComponent

Returns a new instance of UsersAwaitingApprovalComponent.



8
9
10
# File 'app/components/renalware/system/users_awaiting_approval_component.rb', line 8

def initialize(current_user:)
  @current_user = current_user
end

Instance Attribute Details

#current_userObject (readonly)

Returns the value of attribute current_user.



6
7
8
# File 'app/components/renalware/system/users_awaiting_approval_component.rb', line 6

def current_user
  @current_user
end

Instance Method Details

#users_needing_approval_countObject



12
13
14
# File 'app/components/renalware/system/users_awaiting_approval_component.rb', line 12

def users_needing_approval_count
  @users_needing_approval_count ||= User.unapproved.count
end

#users_needing_approval_titleObject



16
17
18
19
20
21
22
# File 'app/components/renalware/system/users_awaiting_approval_component.rb', line 16

def users_needing_approval_title
  [
    users_needing_approval_count,
    "user".pluralize(users_needing_approval_count),
    "awaiting approval"
  ].join(" ")
end