Class: Alchemy::Admin::Dashboard::Widgets::Greeting

Inherits:
ViewComponent::Base
  • Object
show all
Defined in:
app/components/alchemy/admin/dashboard/widgets/greeting.rb

Instance Method Summary collapse

Constructor Details

#initialize(user:) ⇒ Greeting

Returns a new instance of Greeting.



6
7
8
9
10
11
12
# File 'app/components/alchemy/admin/dashboard/widgets/greeting.rb', line 6

def initialize(user:)
  @user = user
  if user.respond_to?(:sign_in_count) && user.respond_to?(:last_sign_in_at)
    @last_sign_at = user.
    @first_time = user. == 1 && @last_sign_at.nil?
  end
end

Instance Method Details

#render?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'app/components/alchemy/admin/dashboard/widgets/greeting.rb', line 14

def render?
  @user.present?
end