Class: AblyUi::Core::MeganavItemsSignedIn

Inherits:
ViewComponent::Base
  • Object
show all
Includes:
MeganavConfig, Util
Defined in:
lib/ably_ui/core/meganav_items_signed_in/meganav_items_signed_in.rb

Constant Summary

Constants included from Util

Util::DEFAULT_URL_BASE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Util

#abs_url, #append_random_postfix

Methods included from MeganavConfig

#panels, #theme, #theme_setup, #themes

Constructor Details

#initialize(session_data:, theme_name:, url_base:) ⇒ MeganavItemsSignedIn

Returns a new instance of MeganavItemsSignedIn.



9
10
11
12
13
# File 'lib/ably_ui/core/meganav_items_signed_in/meganav_items_signed_in.rb', line 9

def initialize(session_data:, theme_name:, url_base:)
  @theme_name = theme_name
  @session_data = session_data
  @url_base = url_base
end

Instance Attribute Details

#url_baseObject (readonly)

Returns the value of attribute url_base.



7
8
9
# File 'lib/ably_ui/core/meganav_items_signed_in/meganav_items_signed_in.rb', line 7

def url_base
  @url_base
end

Instance Method Details

#access_tokens?Boolean

Access tokens are behind a feature flag

Returns:

  • (Boolean)


20
21
22
# File 'lib/ably_ui/core/meganav_items_signed_in/meganav_items_signed_in.rb', line 20

def access_tokens?
  @session_data[:myAccessTokens].present?
end

#account?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/ably_ui/core/meganav_items_signed_in/meganav_items_signed_in.rb', line 15

def account?
  @session_data[:account].present?
end

#account_nameObject



24
25
26
# File 'lib/ably_ui/core/meganav_items_signed_in/meganav_items_signed_in.rb', line 24

def 
  truncate(@session_data[:accountName], length: 20)
end

#preferred_emailObject



28
29
30
# File 'lib/ably_ui/core/meganav_items_signed_in/meganav_items_signed_in.rb', line 28

def preferred_email
  truncate(@session_data[:preferredEmail], length: 20)
end