Method: Cosmos::TargetModel.packets
- Defined in:
- lib/cosmos/models/target_model.rb
.packets(target_name, type: :TLM, scope:) ⇒ Array
Returns Hash>] All packet hashes under the target_name.
97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/cosmos/models/target_model.rb', line 97 def self.packets(target_name, type: :TLM, scope:) raise "Unknown type #{type} for #{target_name}" unless VALID_TYPES.include?(type) raise "Target '#{target_name}' does not exist" unless get(name: target_name, scope: scope) result = [] packets = Store.hgetall("#{scope}__cosmos#{type.to_s.downcase}__#{target_name}") packets.sort.each do |packet_name, packet_json| result << JSON.parse(packet_json) end result end |