Commit c3ca9f57 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Move class_icon providers filtering out of TagRegistry.

Add a generic #tags method to TagRegistry and do the filtering in
Web::ClassIcons instead.
parent 63927567
Loading
Loading
Loading
Loading
+4 −6
Original line number Diff line number Diff line
@@ -32,7 +32,7 @@ module JsDuck
      @html_renderers_sorted = false
      @member_types = []
      @css = []
      @class_icon_providers = []
      @tags = []

      instantiate_tags(TagLoader.new(load_paths).load_all)
    end
@@ -76,9 +76,7 @@ module JsDuck
          @css << tag.css
        end

        if tag.class_icon
          @class_icon_providers << tag
        end
        @tags << tag
      end
    end

@@ -93,8 +91,8 @@ module JsDuck
    # (and in order they should be shown in).
    attr_reader :signatures

    # Array of tags which provide icons for classes.
    attr_reader :class_icon_providers
    # Array of all available tags
    attr_reader :tags

    # Same as #member_types, but returns just the names of member types.
    def member_type_names
+6 −1
Original line number Diff line number Diff line
@@ -57,7 +57,12 @@ module JsDuck
      end

      def self.class_icon_providers
        @providers ||= TagRegistry.class_icon_providers.sort do |a, b|
        @providers ||= generate_class_icon_providers
      end

      # Find tags with #class_icon and sort them from highest priority to lowest
      def self.generate_class_icon_providers
        TagRegistry.tags.find_all {|t| t.class_icon }.sort do |a, b|
          a.class_icon[:priority] <=> b.class_icon[:priority]
        end.reverse
      end