Module: SplitIoClient::LocalhostUtils
- Included in:
- LocalhostSplitClient, LocalhostSplitManager
- Defined in:
- lib/splitclient-rb/localhost_utils.rb
Instance Method Summary collapse
-
#load_localhost_mode_features(splits_file, reload_rate = nil) ⇒ Object
method to set localhost mode features by reading the given .splits.
- #store_features(splits_file) ⇒ Object
Instance Method Details
#load_localhost_mode_features(splits_file, reload_rate = nil) ⇒ Object
method to set localhost mode features by reading the given .splits
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/splitclient-rb/localhost_utils.rb', line 11 def load_localhost_mode_features(splits_file, reload_rate = nil) return @localhost_mode_features unless File.exists?(splits_file) store_features(splits_file) return unless reload_rate Thread.new do loop do @localhost_mode_features = [] store_features(splits_file) sleep(SplitIoClient::Utilities.randomize_interval(reload_rate)) end end end |
#store_features(splits_file) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/splitclient-rb/localhost_utils.rb', line 28 def store_features(splits_file) yaml_extensions = [".yml", ".yaml"] if yaml_extensions.include? File.extname(splits_file) store_yaml_features(splits_file) else store_plain_text_features(splits_file) end end |