Class: Kameleoon::Configuration::DataFile
- Inherits:
-
Object
- Object
- Kameleoon::Configuration::DataFile
- Defined in:
- lib/kameleoon/configuration/data_file.rb
Instance Attribute Summary collapse
-
#audience_tracking_segments ⇒ Object
readonly
Returns the value of attribute audience_tracking_segments.
-
#custom_data_info ⇒ Object
readonly
Returns the value of attribute custom_data_info.
-
#experiment_ids_with_js_css_variable ⇒ Object
readonly
Returns the value of attribute experiment_ids_with_js_css_variable.
-
#feature_flag_by_id ⇒ Object
readonly
Returns the value of attribute feature_flag_by_id.
-
#feature_flags ⇒ Object
readonly
Returns the value of attribute feature_flags.
-
#has_any_targeted_delivery_rule ⇒ Object
readonly
Returns the value of attribute has_any_targeted_delivery_rule.
-
#holdout ⇒ Object
readonly
Returns the value of attribute holdout.
-
#last_modified ⇒ Object
readonly
Returns the value of attribute last_modified.
-
#me_groups ⇒ Object
readonly
Returns the value of attribute me_groups.
-
#rule_info_by_exp_id ⇒ Object
readonly
Returns the value of attribute rule_info_by_exp_id.
-
#segments ⇒ Object
readonly
Returns the value of attribute segments.
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
-
#variation_by_id ⇒ Object
readonly
Returns the value of attribute variation_by_id.
Instance Method Summary collapse
- #experiment_js_css_variable?(experiment_id) ⇒ Boolean
- #get_feature_flag(feature_key) ⇒ Object
-
#initialize(environment, configuration = nil, last_modified = nil) ⇒ DataFile
constructor
A new instance of DataFile.
- #to_s ⇒ Object
Constructor Details
#initialize(environment, configuration = nil, last_modified = nil) ⇒ DataFile
Returns a new instance of DataFile.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/kameleoon/configuration/data_file.rb', line 27 def initialize(environment, configuration = nil, last_modified = nil) Logging::KameleoonLogger.debug( "CALL: DataFile.new(environment: '%s', configuration, last_modified: '%s')", environment, last_modified ) @environment = environment @last_modified = last_modified if configuration.nil? init_default else init(configuration) end collect_indices Logging::KameleoonLogger.debug( "RETURN: DataFile.new(environment: '%s', configuration, last_modified: '%s')", environment, last_modified ) end |
Instance Attribute Details
#audience_tracking_segments ⇒ Object (readonly)
Returns the value of attribute audience_tracking_segments.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def audience_tracking_segments @audience_tracking_segments end |
#custom_data_info ⇒ Object (readonly)
Returns the value of attribute custom_data_info.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def custom_data_info @custom_data_info end |
#experiment_ids_with_js_css_variable ⇒ Object (readonly)
Returns the value of attribute experiment_ids_with_js_css_variable.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def experiment_ids_with_js_css_variable @experiment_ids_with_js_css_variable end |
#feature_flag_by_id ⇒ Object (readonly)
Returns the value of attribute feature_flag_by_id.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def feature_flag_by_id @feature_flag_by_id end |
#feature_flags ⇒ Object (readonly)
Returns the value of attribute feature_flags.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def feature_flags @feature_flags end |
#has_any_targeted_delivery_rule ⇒ Object (readonly)
Returns the value of attribute has_any_targeted_delivery_rule.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def has_any_targeted_delivery_rule @has_any_targeted_delivery_rule end |
#holdout ⇒ Object (readonly)
Returns the value of attribute holdout.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def holdout @holdout end |
#last_modified ⇒ Object (readonly)
Returns the value of attribute last_modified.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def last_modified @last_modified end |
#me_groups ⇒ Object (readonly)
Returns the value of attribute me_groups.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def me_groups @me_groups end |
#rule_info_by_exp_id ⇒ Object (readonly)
Returns the value of attribute rule_info_by_exp_id.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def rule_info_by_exp_id @rule_info_by_exp_id end |
#segments ⇒ Object (readonly)
Returns the value of attribute segments.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def segments @segments end |
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def settings @settings end |
#variation_by_id ⇒ Object (readonly)
Returns the value of attribute variation_by_id.
14 15 16 |
# File 'lib/kameleoon/configuration/data_file.rb', line 14 def variation_by_id @variation_by_id end |
Instance Method Details
#experiment_js_css_variable?(experiment_id) ⇒ Boolean
54 55 56 |
# File 'lib/kameleoon/configuration/data_file.rb', line 54 def experiment_js_css_variable?(experiment_id) @experiment_ids_with_js_css_variable.include?(experiment_id) end |
#get_feature_flag(feature_key) ⇒ Object
46 47 48 49 50 51 52 |
# File 'lib/kameleoon/configuration/data_file.rb', line 46 def get_feature_flag(feature_key) ff = @feature_flags[feature_key] raise Exception::FeatureNotFound, feature_key if ff.nil? raise Exception::FeatureEnvironmentDisabled.new(feature_key, @environment) unless ff.environment_enabled ff end |
#to_s ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/kameleoon/configuration/data_file.rb', line 18 def to_s 'DataFile{' \ "environment:#{@environment}," \ "last_modified:#{@last_modified}," \ "feature_flags:#{@feature_flags.size}," \ "settings:#{@settings}" \ '}' end |