Commit 049e7c50 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Change Tag#process_doc API to take two params.

Instead of returning a hash that gets merged into the final class/member
hash, the latter hash gets passed in as the first parameter and
the #process_doc can add desired fields to it.

This gives #process_doc the ability to check what's already inside the
final hash and then take action depending on that - not just blindly
writing over anything that happens to be there.
parent 96f14b85
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ module JsDuck
      def add_shared(hash, doc_map)
        doc_map.each_pair do |key, value|
          if tag = TagRegistry.get_by_key(key)
            hash.merge!(tag.process_doc(value))
            tag.process_doc(hash, value)
          end
        end

+2 −2
Original line number Diff line number Diff line
@@ -29,8 +29,8 @@ module JsDuck::Tag
      }
    end

    def process_doc(tags)
      {:aliases => tags.map {|tag| tag[:name] }}
    def process_doc(h, tags)
      h[:aliases] = tags.map {|tag| tag[:name] }
    end

    def parse_ext_define(cls, ast)
+2 −2
Original line number Diff line number Diff line
@@ -21,8 +21,8 @@ module JsDuck::Tag
      p.hw.look(/\w+/) ? p.ident.to_sym : nil
    end

    def process_doc(tags)
      {:aside => tags}
    def process_doc(h, tags)
      h[:aside] = tags
    end

    def to_html(context)
+2 −2
Original line number Diff line number Diff line
@@ -17,8 +17,8 @@ module JsDuck::Tag
    end

    # When the tag is found, its value will always be true.
    def process_doc(docs)
      {@key => true}
    def process_doc(h, docs)
      h[@key] = true
    end
  end
end
+2 −2
Original line number Diff line number Diff line
@@ -15,8 +15,8 @@ module JsDuck::Tag
      }
    end

    def process_doc(tags)
      {:name => tags[0][:name]}
    def process_doc(h, tags)
      h[:name] = tags[0][:name]
    end
  end
end
Loading