Class: ForestLiana::Utils::ContextVariables
- Inherits:
-
Object
- Object
- ForestLiana::Utils::ContextVariables
- Defined in:
- app/services/forest_liana/utils/context_variables.rb
Constant Summary collapse
- USER_VALUE_PREFIX =
'currentUser.'.freeze
- USER_VALUE_TAG_PREFIX =
'currentUser.tags.'.freeze
- USER_VALUE_TEAM_PREFIX =
'currentUser.team.'.freeze
Instance Attribute Summary collapse
-
#request_context_variables ⇒ Object
readonly
Returns the value of attribute request_context_variables.
-
#team ⇒ Object
readonly
Returns the value of attribute team.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
- #get_value(context_variable_key) ⇒ Object
-
#initialize(team, user, request_context_variables = nil) ⇒ ContextVariables
constructor
A new instance of ContextVariables.
Constructor Details
#initialize(team, user, request_context_variables = nil) ⇒ ContextVariables
Returns a new instance of ContextVariables.
12 13 14 15 16 |
# File 'app/services/forest_liana/utils/context_variables.rb', line 12 def initialize(team, user, request_context_variables = nil) @team = team @user = user @request_context_variables = request_context_variables end |
Instance Attribute Details
#request_context_variables ⇒ Object (readonly)
Returns the value of attribute request_context_variables.
4 5 6 |
# File 'app/services/forest_liana/utils/context_variables.rb', line 4 def request_context_variables @request_context_variables end |
#team ⇒ Object (readonly)
Returns the value of attribute team.
4 5 6 |
# File 'app/services/forest_liana/utils/context_variables.rb', line 4 def team @team end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
4 5 6 |
# File 'app/services/forest_liana/utils/context_variables.rb', line 4 def user @user end |
Instance Method Details
#get_value(context_variable_key) ⇒ Object
18 19 20 21 22 |
# File 'app/services/forest_liana/utils/context_variables.rb', line 18 def get_value(context_variable_key) return get_current_user_data(context_variable_key) if context_variable_key.start_with?(USER_VALUE_PREFIX) request_context_variables[context_variable_key] if request_context_variables end |