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

Auto-generate list of signatures.

Previously the list was hard-coded. Now all meta-tags with signature
defined are automatically included, and the order is the alphabetical
order of filenames (for builtin tags).
parent 9e6c137b
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -21,7 +21,10 @@ module JsDuck
      if path == :builtins
        load(File.dirname(__FILE__) + "/tag")
      elsif File.directory?(path)
        Dir[path+"/**/*.rb"].each {|file| load_file(file) }
        # Sort paths, so they are always loaded in the same order.
        # This is important for signatures to always be rendered in
        # the same order.
        Dir[path+"/**/*.rb"].sort.each {|file| load_file(file) }
      else
        load_file(path)
      end
+3 −11
Original line number Diff line number Diff line
@@ -56,17 +56,9 @@ module JsDuck
    # (and in order they should be shown in).
    def signatures
      if !@signatures
        @signatures = [
          :static,
          :protected,
          :deprecated,
          :required,
          :template,
          :abstract,
          :readonly,
        ].map do |key|
          s = @map[key].signature
          s[:key] = key
        @signatures = @tags.find_all(&:signature).map do |tag|
          s = tag.signature
          s[:key] = tag.key
          s
        end
      end