Class: Kameleoon::Configuration::CustomDataInfo
- Inherits:
-
Object
- Object
- Kameleoon::Configuration::CustomDataInfo
- Defined in:
- lib/kameleoon/configuration/custom_data_info.rb
Constant Summary collapse
- SCOPE_VISITOR =
'VISITOR'
Instance Attribute Summary collapse
-
#local_only ⇒ Object
readonly
Returns the value of attribute local_only.
-
#mapping_identifier_index ⇒ Object
readonly
Returns the value of attribute mapping_identifier_index.
-
#visitor_scope ⇒ Object
readonly
Returns the value of attribute visitor_scope.
Instance Method Summary collapse
-
#initialize(hashes, log_func = nil) ⇒ CustomDataInfo
constructor
A new instance of CustomDataInfo.
- #local_only?(index) ⇒ Boolean
- #mapping_identifier?(index) ⇒ Boolean
- #visitor_scope?(index) ⇒ Boolean
Constructor Details
#initialize(hashes, log_func = nil) ⇒ CustomDataInfo
Returns a new instance of CustomDataInfo.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/kameleoon/configuration/custom_data_info.rb', line 11 def initialize(hashes, log_func = nil) @local_only = Set[] @visitor_scope = Set[] @log_func = log_func unless hashes.nil? for hash in hashes index = hash['index'] @local_only.add(index) if hash['localOnly'] @visitor_scope.add(index) if hash['scope'] == SCOPE_VISITOR if hash['isMappingIdentifier'] if @mapping_identifier_index != nil @log_func&.call('More than one mapping identifier is set. Undefined behavior may occur on cross-device reconciliation.') end @mapping_identifier_index = index end end end end |
Instance Attribute Details
#local_only ⇒ Object (readonly)
Returns the value of attribute local_only.
8 9 10 |
# File 'lib/kameleoon/configuration/custom_data_info.rb', line 8 def local_only @local_only end |
#mapping_identifier_index ⇒ Object (readonly)
Returns the value of attribute mapping_identifier_index.
8 9 10 |
# File 'lib/kameleoon/configuration/custom_data_info.rb', line 8 def mapping_identifier_index @mapping_identifier_index end |
#visitor_scope ⇒ Object (readonly)
Returns the value of attribute visitor_scope.
8 9 10 |
# File 'lib/kameleoon/configuration/custom_data_info.rb', line 8 def visitor_scope @visitor_scope end |
Instance Method Details
#local_only?(index) ⇒ Boolean
30 31 32 |
# File 'lib/kameleoon/configuration/custom_data_info.rb', line 30 def local_only? (index) @local_only.include?(index) end |
#mapping_identifier?(index) ⇒ Boolean
34 35 36 |
# File 'lib/kameleoon/configuration/custom_data_info.rb', line 34 def mapping_identifier? (index) index == @mapping_identifier_index end |
#visitor_scope?(index) ⇒ Boolean
38 39 40 |
# File 'lib/kameleoon/configuration/custom_data_info.rb', line 38 def visitor_scope? (index) @visitor_scope.include?(index) end |