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

Parameter lists also for events.

parent e6d5ea3e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ module JsDuck
    end

    def signature_suffix(item)
      " : ()"
      " : " + short_param_list(item)
    end
  end

+0 −8
Original line number Diff line number Diff line
@@ -13,14 +13,6 @@ module JsDuck
    def signature_suffix(item)
      short_param_list(item) + " : " + (item[:return] ? (item[:return][:type] || "void") : "void")
    end

    def short_param_list(item)
      params = item[:params].collect do |p|
        (p[:type] || "Object") + " " + (p[:name] || "")
      end
      return params.length > 0 ? ("( " + params.join(", ") + " )") : "()"
    end

  end

end
+8 −0
Original line number Diff line number Diff line
@@ -45,6 +45,14 @@ module JsDuck
      return "<a id='#{id}'></a><b><a href='#{src}'>#{item[:name]}</a></b>" + signature_suffix(item)
    end

    # Creates parameter list used in method and event signature.
    def short_param_list(item)
      params = item[:params].collect do |p|
        (p[:type] || "Object") + " " + (p[:name] || "")
      end
      return params.length > 0 ? ("( " + params.join(", ") + " )") : "()"
    end

    # 116 chars is also where ext-doc makes its cut, but unlike
    # ext-doc we only make the cut when there's more than 120 chars.
    #