Sha256: e6d9a55a02bd82db47e0bd6b66a79cad5e982c912de7aa3ca34277fc310adf0c
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true module JsDependency module Report class Markdown attr_reader :orphan_list, :mermaid_markdown, :identifier # @param [Array] orphan_list # @param [String] mermaid_markdown # @param [nil, String] identifier def initialize(orphan_list, mermaid_markdown, identifier: nil) @orphan_list = orphan_list || [] @mermaid_markdown = mermaid_markdown @identifier = identifier || "js_dependency_report_identifier" end # @return [String] def export markdown = <<~MAKRDOWNTEXT ## JsDependency Reports ### Orphan modules MAKRDOWNTEXT if @orphan_list.empty? markdown += "No orphaned module !\n\n" else markdown += "#{@orphan_list.size} orphaned modules.\n\n" markdown += "#{@orphan_list.map { |str| "* ``#{str}``" }.join("\n")}\n\n" end markdown += "### Module dependency\n\n" if @mermaid_markdown.nil? || @mermaid_markdown.empty? markdown += ".vue or .js or .jsx files are not changed.\n\n" else markdown += <<~MAKRDOWNTEXT ```mermaid MAKRDOWNTEXT markdown += @mermaid_markdown.to_s markdown += <<~MAKRDOWNTEXT ``` MAKRDOWNTEXT end markdown += "<!-- #{@identifier} -->" markdown end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
js_dependency-0.4.1 | lib/js_dependency/report/markdown.rb |
js_dependency-0.4.0 | lib/js_dependency/report/markdown.rb |