Class: Alchemy::Admin::Dashboard::Widgets::Greeting
- Inherits:
-
ViewComponent::Base
- Object
- ViewComponent::Base
- Alchemy::Admin::Dashboard::Widgets::Greeting
- Defined in:
- app/components/alchemy/admin/dashboard/widgets/greeting.rb
Instance Method Summary collapse
-
#initialize(user:) ⇒ Greeting
constructor
A new instance of Greeting.
- #render? ⇒ Boolean
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.last_sign_in_at @first_time = user.sign_in_count == 1 && @last_sign_at.nil? end end |
Instance Method Details
#render? ⇒ Boolean
14 15 16 |
# File 'app/components/alchemy/admin/dashboard/widgets/greeting.rb', line 14 def render? @user.present? end |