Sha256: 09f9c9909b3936d026b2eb8bb8b5c75e71f155a0c292d9d067c0d98cfa4b8704
Contents?: true
Size: 977 Bytes
Versions: 4
Compression:
Stored size: 977 Bytes
Contents
module ActiveAdminMenu class Menu attr_reader :items def initialize @items = [] end def find_item_by(resource_name:) items.detect { |item| item.resource_name == resource_name } end def add(resource_name:, parent: nil) items << Item.new(resource_name: resource_name, parent: parent, priority: items.length + 1) end class << self def build new.tap do |menu| namespaced_source.each do |key, resource_names| parent = key == uncategorize_key_name ? nil : key resource_names.each do |resource_name| menu.add(resource_name: resource_name, parent: parent) end end end end private def namespaced_source config.namespaced_source end def uncategorize_key_name config.uncategorize_key_name end def config @_config ||= ::ActiveAdminMenu.config end end end end
Version data entries
4 entries across 4 versions & 1 rubygems