Class: ComponentLink
- Inherits:
-
Object
- Object
- ComponentLink
- Defined in:
- lib/cpp_dependency_graph/component_link.rb
Instance Method Summary collapse
- #cyclic? ⇒ Boolean
-
#initialize(source, target, cyclic = false) ⇒ ComponentLink
constructor
A new instance of ComponentLink.
- #source ⇒ Object
- #target ⇒ Object
- #to_json(*a) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(source, target, cyclic = false) ⇒ ComponentLink
6 7 8 9 10 |
# File 'lib/cpp_dependency_graph/component_link.rb', line 6 def initialize(source, target, cyclic = false) @source = source @target = target @cyclic = cyclic end |
Instance Method Details
#cyclic? ⇒ Boolean
20 21 22 |
# File 'lib/cpp_dependency_graph/component_link.rb', line 20 def cyclic? @cyclic end |
#source ⇒ Object
12 13 14 |
# File 'lib/cpp_dependency_graph/component_link.rb', line 12 def source @source end |
#target ⇒ Object
16 17 18 |
# File 'lib/cpp_dependency_graph/component_link.rb', line 16 def target @target end |
#to_json(*a) ⇒ Object
32 33 34 35 36 |
# File 'lib/cpp_dependency_graph/component_link.rb', line 32 def to_json(*a) { json_class: self.class.name, source: source, target: target, cyclic: cyclic? }.to_json(*a) end |
#to_s ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/cpp_dependency_graph/component_link.rb', line 24 def to_s if cyclic? "#{source} <-> #{target}" else "#{source} -> #{target}" end end |