Class: IronAdmin::ToolRegistry
- Inherits:
-
Object
- Object
- IronAdmin::ToolRegistry
- Defined in:
- lib/iron_admin/tool_registry.rb
Class Method Summary collapse
- .all ⇒ Object
- .find(tool_name) ⇒ Object
- .grouped ⇒ Object
- .register(tool_class) ⇒ Object
- .reset! ⇒ Object
- .sorted ⇒ Object
Class Method Details
.all ⇒ Object
10 11 12 |
# File 'lib/iron_admin/tool_registry.rb', line 10 def all tools.values end |
.find(tool_name) ⇒ Object
14 15 16 |
# File 'lib/iron_admin/tool_registry.rb', line 14 def find(tool_name) tools[tool_name.to_s] end |
.grouped ⇒ Object
18 19 20 |
# File 'lib/iron_admin/tool_registry.rb', line 18 def grouped all.group_by { |tool| tool.[:group] || "Tools" } end |
.register(tool_class) ⇒ Object
6 7 8 |
# File 'lib/iron_admin/tool_registry.rb', line 6 def register(tool_class) tools[tool_class.tool_name] = tool_class end |
.reset! ⇒ Object
26 27 28 |
# File 'lib/iron_admin/tool_registry.rb', line 26 def reset! @tools = {} end |
.sorted ⇒ Object
22 23 24 |
# File 'lib/iron_admin/tool_registry.rb', line 22 def sorted all.sort_by { |tool| tool.[:priority] || 999 } end |