Class: SplitIoClient::LocalhostSplitManager
- Inherits:
-
Object
- Object
- SplitIoClient::LocalhostSplitManager
- Includes:
- LocalhostUtils
- Defined in:
- lib/splitclient-rb/managers/localhost_split_manager.rb
Instance Method Summary collapse
-
#initialize(splits_file, reload_rate = nil) ⇒ LocalhostSplitIoManager
constructor
Creates a new split manager instance that holds the splits from a given file.
-
#split(split_name) ⇒ Object
method to get a split view.
-
#split_names ⇒ Object
method to get the list of just split names.
-
#splits ⇒ Object
method to get the split list from the client.
Methods included from LocalhostUtils
#load_localhost_mode_features, #store_features
Constructor Details
#initialize(splits_file, reload_rate = nil) ⇒ LocalhostSplitIoManager
Creates a new split manager instance that holds the splits from a given file
12 13 14 15 16 17 |
# File 'lib/splitclient-rb/managers/localhost_split_manager.rb', line 12 def initialize(splits_file, reload_rate = nil) @localhost_mode = true @localhost_mode_features = [] load_localhost_mode_features(splits_file, reload_rate) end |
Instance Method Details
#split(split_name) ⇒ Object
method to get a split view
23 24 25 |
# File 'lib/splitclient-rb/managers/localhost_split_manager.rb', line 23 def split(split_name) @localhost_mode_features.find { |x| x[:feature] == split_name } end |
#split_names ⇒ Object
method to get the list of just split names. Ideal for ietrating and calling client.get_treatment
39 40 41 42 43 |
# File 'lib/splitclient-rb/managers/localhost_split_manager.rb', line 39 def split_names @localhost_mode_features.each_with_object([]) do |split, memo| memo << split[:feature] end end |
#splits ⇒ Object
method to get the split list from the client
31 32 33 |
# File 'lib/splitclient-rb/managers/localhost_split_manager.rb', line 31 def splits @localhost_mode_features end |