class Featureflow::Configuration
Constants
- DEFAULT_ENDPOINT
- DEFAULT_EVENT_ENDPOINT
Attributes
api_key[RW]
disable_events[RW]
endpoint[RW]
event_endpoint[RW]
logger[RW]
with_features[RW]
Public Class Methods
new()
click to toggle source
# File lib/featureflow/configuration.rb, line 12 def initialize self.api_key = ENV["FEATUREFLOW_SERVER_KEY"] self.endpoint = DEFAULT_ENDPOINT self.event_endpoint = DEFAULT_EVENT_ENDPOINT self.disable_events = false self.with_features = [] self.logger = Logger.new(STDOUT) self.logger.level = Logger::WARN end
Public Instance Methods
validate!()
click to toggle source
# File lib/featureflow/configuration.rb, line 23 def validate! unless with_features_valid? @with_features raise ArgumentError, 'with_features must be an array of Feature hashes. Use Featureflow::Feature.create(key, failover_variant)' end end
Private Instance Methods
with_features_valid?(features)
click to toggle source
# File lib/featureflow/configuration.rb, line 31 def with_features_valid?(features) features.all? do |feature| feature[:key].is_a?(String) && feature[:failover_variant].is_a?(String) && feature[:variants].is_a?(Array) end end