Class: Statsig::SDKConfigs
- Inherits:
-
Object
- Object
- Statsig::SDKConfigs
- Defined in:
- lib/sdk_configs.rb
Instance Method Summary collapse
- #get_config_int_value(config) ⇒ Object
- #get_config_num_value(config) ⇒ Object
- #get_config_string_value(config) ⇒ Object
-
#initialize ⇒ SDKConfigs
constructor
A new instance of SDKConfigs.
- #on(flag) ⇒ Object
- #set_configs(new_configs) ⇒ Object
- #set_flags(new_flags) ⇒ Object
Constructor Details
#initialize ⇒ SDKConfigs
Returns a new instance of SDKConfigs.
5 6 7 8 |
# File 'lib/sdk_configs.rb', line 5 def initialize @configs = Concurrent::Hash.new @flags = Concurrent::Hash.new end |
Instance Method Details
#get_config_int_value(config) ⇒ Object
32 33 34 35 |
# File 'lib/sdk_configs.rb', line 32 def get_config_int_value(config) value = @configs[config.to_sym] value.is_a?(Integer) ? value : nil end |
#get_config_num_value(config) ⇒ Object
22 23 24 25 |
# File 'lib/sdk_configs.rb', line 22 def get_config_num_value(config) value = @configs[config.to_sym] value.is_a?(Numeric) ? value.to_f : nil end |
#get_config_string_value(config) ⇒ Object
27 28 29 30 |
# File 'lib/sdk_configs.rb', line 27 def get_config_string_value(config) value = @configs[config.to_sym] value.is_a?(String) ? value : nil end |
#on(flag) ⇒ Object
18 19 20 |
# File 'lib/sdk_configs.rb', line 18 def on(flag) @flags[flag.to_sym] == true end |
#set_configs(new_configs) ⇒ Object
14 15 16 |
# File 'lib/sdk_configs.rb', line 14 def set_configs(new_configs) @configs = new_configs || Concurrent::Hash.new end |
#set_flags(new_flags) ⇒ Object
10 11 12 |
# File 'lib/sdk_configs.rb', line 10 def set_flags(new_flags) @flags = new_flags || Concurrent::Hash.new end |