Sha256: ccc21679be85ac829a3b8272d939778374dd4e85ec2c3878eea340edee8fba74

Contents?: true

Size: 777 Bytes

Versions: 29

Compression:

Stored size: 777 Bytes

Contents

# frozen_string_literal: true

module PagesCore
  class AdminMenuItem
    attr_reader :label, :path, :group, :options

    class << self
      def items
        return [] unless @menu_items

        @menu_items.map { |_, v| v }
      end

      def register(label, path, group = :custom, options = {})
        entry = new(label, path, group, options)
        @menu_items ||= {}
        @menu_items[[group, label]] = entry
      end
    end

    def initialize(label, path, group = :custom, options = {})
      @label = label
      @path = path
      @group = group
      @options = options
    end

    def ==(other)
      other &&
        other.label == label &&
        other.path == path &&
        other.group == group &&
        other.options == options
    end
  end
end

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
pages_core-3.15.5 lib/pages_core/admin_menu_item.rb
pages_core-3.15.4 lib/pages_core/admin_menu_item.rb
pages_core-3.15.3 lib/pages_core/admin_menu_item.rb
pages_core-3.15.2 lib/pages_core/admin_menu_item.rb
pages_core-3.15.1 lib/pages_core/admin_menu_item.rb
pages_core-3.14.0 lib/pages_core/admin_menu_item.rb
pages_core-3.13.0 lib/pages_core/admin_menu_item.rb
pages_core-3.12.7 lib/pages_core/admin_menu_item.rb
pages_core-3.12.6 lib/pages_core/admin_menu_item.rb
pages_core-3.12.5 lib/pages_core/admin_menu_item.rb
pages_core-3.12.4 lib/pages_core/admin_menu_item.rb
pages_core-3.12.3 lib/pages_core/admin_menu_item.rb
pages_core-3.12.2 lib/pages_core/admin_menu_item.rb
pages_core-3.12.1 lib/pages_core/admin_menu_item.rb
pages_core-3.12.0 lib/pages_core/admin_menu_item.rb
pages_core-3.11.3 lib/pages_core/admin_menu_item.rb
pages_core-3.11.2 lib/pages_core/admin_menu_item.rb
pages_core-3.11.1 lib/pages_core/admin_menu_item.rb
pages_core-3.11.0 lib/pages_core/admin_menu_item.rb
pages_core-3.10.2 lib/pages_core/admin_menu_item.rb