Class: JsDependency::Report::Markdown
- Inherits:
-
Object
- Object
- JsDependency::Report::Markdown
- Defined in:
- lib/js_dependency/report/markdown.rb
Instance Attribute Summary collapse
-
#identifier ⇒ Object
readonly
Returns the value of attribute identifier.
-
#mermaid_markdown ⇒ Object
readonly
Returns the value of attribute mermaid_markdown.
-
#orphan_list ⇒ Object
readonly
Returns the value of attribute orphan_list.
Instance Method Summary collapse
- #export ⇒ String
-
#initialize(orphan_list, mermaid_markdown, identifier: nil) ⇒ Markdown
constructor
A new instance of Markdown.
Constructor Details
#initialize(orphan_list, mermaid_markdown, identifier: nil) ⇒ Markdown
11 12 13 14 15 |
# File 'lib/js_dependency/report/markdown.rb', line 11 def initialize(orphan_list, mermaid_markdown, identifier: nil) @orphan_list = orphan_list || [] @mermaid_markdown = mermaid_markdown @identifier = identifier || "js_dependency_report_identifier" end |
Instance Attribute Details
#identifier ⇒ Object (readonly)
Returns the value of attribute identifier.
6 7 8 |
# File 'lib/js_dependency/report/markdown.rb', line 6 def identifier @identifier end |
#mermaid_markdown ⇒ Object (readonly)
Returns the value of attribute mermaid_markdown.
6 7 8 |
# File 'lib/js_dependency/report/markdown.rb', line 6 def mermaid_markdown @mermaid_markdown end |
#orphan_list ⇒ Object (readonly)
Returns the value of attribute orphan_list.
6 7 8 |
# File 'lib/js_dependency/report/markdown.rb', line 6 def orphan_list @orphan_list end |
Instance Method Details
#export ⇒ String
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/js_dependency/report/markdown.rb', line 18 def export markdown = " ## JsDependency Reports\n\n ### Orphan modules\n\n MAKRDOWNTEXT\n\n if @orphan_list.empty?\n markdown += \"No orphaned module !\\n\\n\"\n else\n markdown += \"\#{@orphan_list.size} orphaned modules.\\n\\n\"\n markdown += \"\#{@orphan_list.map { |str| \"* ``\#{str}``\" }.join(\"\\n\")}\\n\\n\"\n end\n\n markdown += \"### Module dependency\\n\\n\"\n\n if @mermaid_markdown.nil? || @mermaid_markdown.empty?\n markdown += \".vue or .js or .jsx files are not changed.\\n\\n\"\n else\n markdown += <<~\"MAKRDOWNTEXT\"\n ```mermaid\n MAKRDOWNTEXT\n\n markdown += @mermaid_markdown.to_s\n\n markdown += <<~\"MAKRDOWNTEXT\"\n ```\n\n MAKRDOWNTEXT\n end\n\n markdown += \"<!-- \#{@identifier} -->\"\n markdown\nend\n" |