diff --git a/lib/ldclient-rb/impl/data_source.rb b/lib/ldclient-rb/impl/data_source.rb index 4eed9ecc..2fdd983c 100644 --- a/lib/ldclient-rb/impl/data_source.rb +++ b/lib/ldclient-rb/impl/data_source.rb @@ -178,7 +178,7 @@ def update_status(new_state, new_error) private def send_change_events(affected_items) affected_items.each do |item| if item[:kind] == Impl::DataStore::FEATURES - @flag_change_broadcaster.broadcast(LaunchDarkly::Interfaces::FlagChange.new(item[:key])) + @flag_change_broadcaster.broadcast(LaunchDarkly::Interfaces::FlagChange.new(item[:key].to_s)) end end end diff --git a/lib/ldclient-rb/impl/data_store/in_memory_feature_store.rb b/lib/ldclient-rb/impl/data_store/in_memory_feature_store.rb index 85c91225..cef3de7f 100644 --- a/lib/ldclient-rb/impl/data_store/in_memory_feature_store.rb +++ b/lib/ldclient-rb/impl/data_store/in_memory_feature_store.rb @@ -58,7 +58,7 @@ def initialized? # # Initializes the store with a full set of data, replacing any existing data. # - # @param collections [Hash>] Hash of data kinds to collections of items + # @param collections [Hash>] Hash of data kinds to collections of items # @return [Boolean] true if successful, false otherwise # def set_basis(collections) @@ -80,7 +80,7 @@ def set_basis(collections) # # Applies a delta update to the store. # - # @param collections [Hash>] Hash of data kinds to collections with updates + # @param collections [Hash>] Hash of data kinds to collections with updates # @return [Boolean] true if successful, false otherwise # def apply_delta(collections) @@ -105,7 +105,7 @@ def apply_delta(collections) # # Decodes a collection of items. # - # @param collections [Hash>] Hash of data kinds to collections + # @param collections [Hash>] Hash of data kinds to collections # @return [Hash>, nil] Decoded collection with symbol keys, or nil on error # private def decode_collection(collections) diff --git a/lib/ldclient-rb/impl/data_store/store.rb b/lib/ldclient-rb/impl/data_store/store.rb index 5fa7fcf4..93ac3989 100644 --- a/lib/ldclient-rb/impl/data_store/store.rb +++ b/lib/ldclient-rb/impl/data_store/store.rb @@ -193,7 +193,7 @@ def get_data_store_status_provider # # Set the basis of the store. Any existing data is discarded. # - # @param collections [Hash{Object => Hash{String => Hash}}] Hash of data kinds to collections of items + # @param collections [Hash{Object => Hash{Symbol => Hash}}] Hash of data kinds to collections of items # @param selector [LaunchDarkly::Interfaces::DataSystem::Selector, nil] The selector # @param persist [Boolean] Whether to persist the data # @return [void] @@ -234,7 +234,7 @@ def get_data_store_status_provider # # Apply a delta update to the store. # - # @param collections [Hash{Object => Hash{String => Hash}}] Hash of data kinds to collections with updates + # @param collections [Hash{Object => Hash{Symbol => Hash}}] Hash of data kinds to collections with updates # @param selector [LaunchDarkly::Interfaces::DataSystem::Selector, nil] The selector # @param persist [Boolean] Whether to persist the changes # @return [void] @@ -328,7 +328,7 @@ def get_data_store_status_provider private def send_change_events(affected_items) affected_items.each do |item| if item[:kind] == FEATURES - @flag_change_broadcaster.broadcast(LaunchDarkly::Interfaces::FlagChange.new(item[:key])) + @flag_change_broadcaster.broadcast(LaunchDarkly::Interfaces::FlagChange.new(item[:key].to_s)) end end end @@ -336,8 +336,8 @@ def get_data_store_status_provider # # Compute which items changed between old and new data sets. # - # @param old_data [Hash{DataKind => Hash{String => Hash}}] Old data hash - # @param new_data [Hash{DataKind => Hash{String => Hash}}] New data hash + # @param old_data [Hash{DataKind => Hash{Symbol => Hash}}] Old data hash + # @param new_data [Hash{DataKind => Hash{Symbol => Hash}}] New data hash # @return [Set] Set of {kind:, key:} hashes # private def compute_changed_items_for_full_data_set(old_data, new_data) diff --git a/lib/ldclient-rb/impl/dependency_tracker.rb b/lib/ldclient-rb/impl/dependency_tracker.rb index 7ae3c79d..746bcf3f 100644 --- a/lib/ldclient-rb/impl/dependency_tracker.rb +++ b/lib/ldclient-rb/impl/dependency_tracker.rb @@ -13,7 +13,7 @@ def initialize(logger = nil) # Updates the dependency graph when an item has changed. # # @param from_kind [Object] the changed item's kind - # @param from_key [String] the changed item's key + # @param from_key [Symbol] the changed item's key # @param from_item [Object] the changed item (can be a Hash, model object, or nil) # def update_dependencies_from(from_kind, from_key, from_item) diff --git a/lib/ldclient-rb/impl/flag_tracker.rb b/lib/ldclient-rb/impl/flag_tracker.rb index 83341118..0595b251 100644 --- a/lib/ldclient-rb/impl/flag_tracker.rb +++ b/lib/ldclient-rb/impl/flag_tracker.rb @@ -26,7 +26,7 @@ def add_flag_value_change_listener(key, context, listener) # An adapter which turns a normal flag change listener into a flag value change listener. # class FlagValueChangeAdapter - # @param [Symbol] flag_key + # @param [String] flag_key # @param [LaunchDarkly::LDContext] context # @param [#update] listener # @param [#call] eval_fn diff --git a/lib/ldclient-rb/interfaces/flag_tracker.rb b/lib/ldclient-rb/interfaces/flag_tracker.rb index 3c8a8f8c..6295b3c3 100644 --- a/lib/ldclient-rb/interfaces/flag_tracker.rb +++ b/lib/ldclient-rb/interfaces/flag_tracker.rb @@ -66,7 +66,7 @@ def remove_listener(listener) end # The returned listener represents the subscription that was created by this method # call; to unsubscribe, pass that object (not your listener) to {#remove_listener}. # - # @param key [Symbol] + # @param key [String] # @param context [LaunchDarkly::LDContext] # @param listener [#update] # @@ -79,7 +79,7 @@ def add_flag_value_change_listener(key, context, listener) end class FlagChange attr_accessor :key - # @param [Symbol] key + # @param key [String] def initialize(key) @key = key end @@ -93,9 +93,9 @@ class FlagValueChange attr_accessor :old_value attr_accessor :new_value - # @param [Symbol] key - # @param [Object] old_value - # @param [Object] new_value + # @param key [String] + # @param old_value [Object] + # @param new_value [Object] def initialize(key, old_value, new_value) @key = key @old_value = old_value diff --git a/spec/impl/data_system/fdv2_datasystem_spec.rb b/spec/impl/data_system/fdv2_datasystem_spec.rb index 44c85548..6aabfc3c 100644 --- a/spec/impl/data_system/fdv2_datasystem_spec.rb +++ b/spec/impl/data_system/fdv2_datasystem_spec.rb @@ -65,9 +65,9 @@ def build(_sdk_key, _config) expect(modified.wait(1)).to be true expect(changes.length).to eq(3) - expect(changes[0].key).to eq(:flagkey) - expect(changes[1].key).to eq(:flagkey) - expect(changes[2].key).to eq(:flagkey) + expect(changes[0].key).to eq("flagkey") + expect(changes[1].key).to eq("flagkey") + expect(changes[2].key).to eq("flagkey") fdv2.stop end @@ -166,8 +166,8 @@ def build(_sdk_key, _config) expect(changed.wait(2)).to be true expect(changes.length).to eq(2) - expect(changes[0].key).to eq(:flagkey) - expect(changes[1].key).to eq(:flagkey) + expect(changes[0].key).to eq("flagkey") + expect(changes[1].key).to eq("flagkey") fdv2.stop end @@ -263,7 +263,7 @@ def build(_sdk_key, _config) # Verify we got flag changes from FDv1 expect(changes.length).to be > 0 - expect(changes.any? { |change| change.key == :fdv1flag }).to be true + expect(changes.any? { |change| change.key == "fdv1flag" }).to be true fdv2.stop end @@ -318,7 +318,7 @@ def build(_sdk_key, _config) # Verify FDv1 is active and we got both changes expect(changes.length).to eq(2) - expect(changes.all? { |change| change.key == :fdv1fallbackflag }).to be true + expect(changes.all? { |change| change.key == "fdv1fallbackflag" }).to be true fdv2.stop end @@ -369,8 +369,8 @@ def build(_sdk_key, _config) # Verify we got changes for both flags flag_keys = changes.map { |change| change.key } - expect(flag_keys).to include(:initialflag) - expect(flag_keys).to include(:fdv1replacementflag) + expect(flag_keys).to include("initialflag") + expect(flag_keys).to include("fdv1replacementflag") fdv2.stop end diff --git a/spec/impl/data_system/fdv2_persistence_spec.rb b/spec/impl/data_system/fdv2_persistence_spec.rb index 8eee67cc..d629cd5b 100644 --- a/spec/impl/data_system/fdv2_persistence_spec.rb +++ b/spec/impl/data_system/fdv2_persistence_spec.rb @@ -147,7 +147,7 @@ def get_data_snapshot listener = Object.new listener.define_singleton_method(:update) do |flag_change| changes << flag_change - flag_changed.set if flag_change.key == :newflag + flag_changed.set if flag_change.key == "newflag" end fdv2.flag_change_broadcaster.add_listener(listener) @@ -326,7 +326,7 @@ def get_data_snapshot flag_changed = Concurrent::Event.new listener = Object.new listener.define_singleton_method(:update) do |flag_change| - flag_changed.set if flag_change.key == :flagkey + flag_changed.set if flag_change.key == "flagkey" end fdv2.flag_change_broadcaster.add_listener(listener) @@ -412,7 +412,7 @@ def get_data_snapshot listener = Object.new listener.define_singleton_method(:update) do |flag_change| - sync_flag_arrived.set if flag_change.key == :"sync-flag" + sync_flag_arrived.set if flag_change.key == "sync-flag" end fdv2.flag_change_broadcaster.add_listener(listener)