Module: Hyrax::TwitterPresenter
- Defined in:
- app/presenters/hyrax/twitter_presenter.rb
Overview
Note:
The duplication of code was found via the flay gem
Repeatable logic for presenting twitter handles.
Class Method Summary collapse
-
.twitter_handle_for(user_key:) ⇒ String
The twitter handle appropriate for the given user key.
Class Method Details
.twitter_handle_for(user_key:) ⇒ String
Returns the twitter handle appropriate for the given user key.
9 10 11 12 13 14 15 16 |
# File 'app/presenters/hyrax/twitter_presenter.rb', line 9 def self.twitter_handle_for(user_key:) user = ::User.find_by_user_key(user_key) if user.try(:twitter_handle).present? "@#{user.twitter_handle}" else I18n.translate('hyrax.product_twitter_handle') end end |