Class: JsDependency::Mermaid::NodesLink

Inherits:
Object
  • Object
show all
Defined in:
lib/js_dependency/mermaid/nodes_link.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent, child) ⇒ NodesLink

Returns a new instance of NodesLink.

Parameters:

  • parent (String)
  • child (String)


12
13
14
15
# File 'lib/js_dependency/mermaid/nodes_link.rb', line 12

def initialize(parent, child)
  @parent = Pathname.new(parent)
  @child = Pathname.new(child)
end

Instance Attribute Details

#childObject (readonly)

Returns the value of attribute child.



8
9
10
# File 'lib/js_dependency/mermaid/nodes_link.rb', line 8

def child
  @child
end

#parentObject (readonly)

Returns the value of attribute parent.



8
9
10
# File 'lib/js_dependency/mermaid/nodes_link.rb', line 8

def parent
  @parent
end

Instance Method Details

#child_module_name(level = 0) ⇒ String

Parameters:

  • level (Integer) (defaults to: 0)

Returns:

  • (String)


25
26
27
# File 'lib/js_dependency/mermaid/nodes_link.rb', line 25

def child_module_name(level = 0)
  mermaid_str(@child, level)
end

#parent_module_name(level = 0) ⇒ String

Parameters:

  • level (Integer) (defaults to: 0)

Returns:

  • (String)


19
20
21
# File 'lib/js_dependency/mermaid/nodes_link.rb', line 19

def parent_module_name(level = 0)
  mermaid_str(@parent, level)
end

#relative_path_from(src_path) ⇒ JsDependency::Mermaid::NodesLink

Parameters:

  • src_path (String)

Returns:



31
32
33
34
35
36
# File 'lib/js_dependency/mermaid/nodes_link.rb', line 31

def relative_path_from(src_path)
  NodesLink.new(
    relative_parent_path(src_path),
    relative_child_path(src_path)
  )
end