Method: OpenC3::LimitsEventTopic.delete
- Defined in:
- lib/openc3/topics/limits_event_topic.rb
.delete(target_name, packet_name = nil, scope:) ⇒ Object
Cleanups up the current_limits and current_limits_settings keys for a target or target/packet combination
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
# File 'lib/openc3/topics/limits_event_topic.rb', line 140 def self.delete(target_name, packet_name = nil, scope:) limits = Store.hgetall("#{scope}__current_limits") limits.each do |item, _limits_state| if packet_name if item =~ /^#{target_name}__#{packet_name}__/ Store.hdel("#{scope}__current_limits", item) end else if item =~ /^#{target_name}__/ Store.hdel("#{scope}__current_limits", item) end end end limits_settings = Store.hgetall("#{scope}__current_limits_settings") limits_settings.each do |item, _limits_settings| if packet_name if item =~ /^#{target_name}__#{packet_name}__/ Store.hdel("#{scope}__current_limits_settings", item) end else if item =~ /^#{target_name}__/ Store.hdel("#{scope}__current_limits_settings", item) end end end end |