Method: OpenC3::ToolModel.all

Defined in:
lib/openc3/models/tool_model.rb

.all(scope: nil) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/openc3/models/tool_model.rb', line 58

def self.all(scope: nil)
  ordered_array = []
  tools = unordered_all(scope: scope)
  tools.each do |_name, tool|
    ordered_array << tool
  end
  ordered_array.sort! { |a, b| a['position'] <=> b['position'] }
  ordered_hash = {}
  ordered_array.each do |tool|
    ordered_hash[tool['name']] = tool
  end
  ordered_hash
end