Sha256: df3e97bd4a5d4de1d0a087f1c16e1df8cb20fa0e268551af3876223b919c2a28
Contents?: true
Size: 746 Bytes
Versions: 1
Compression:
Stored size: 746 Bytes
Contents
# frozen_string_literal: true module JsDependency module Mermaid class NodesLink attr_reader :parent, :child def initialize(parent, child) @parent = Pathname.new(parent) @child = Pathname.new(child) end def parent_module_name(level = 0) mermaid_str(@parent, level) end def child_module_name(level = 0) mermaid_str(@child, level) end private def mermaid_str(pathname, level = 0) "#{parse(pathname).join("_")}[\"#{parse(pathname, level).join("/")}\"]" end def parse(pathname, level = -1) pathname.each_filename.with_object([]) { |filename, array| array << filename }.reverse[0..level].reverse end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
js_dependency-0.3.0 | lib/js_dependency/mermaid/nodes_link.rb |